comfy-table icon indicating copy to clipboard operation
comfy-table copied to clipboard

Add a new row or column in a specific position.

Open pedrohba1 opened this issue 1 year ago • 0 comments

A detailed description of the feature you would like to see added.

Currently, it can only add rows and columns to the back of the table. I would like a integrated function to add a new column or row in a specific position. I think this implementation might not be in the interest of this project because it envolves making some quite costly operations, that can involve shifting all other values in order to fit the new value in the specified position. But it would be cool to have this.

    pub fn add_rows_in_index<I>(&mut self, rows: I, index: usize) -> &mut Self

And something similar for columns.

Explain your usecase of the requested feature

Basically, I wanted to do this exercise using this crate, for the sake of using something that I was unused to: https://adventofcode.com/2023/day/11

And having this function in this scenario would be handy.

Alternatives

You can make this functionality raw with a very simple function I guess, but it would be cool to have it implemented, since it is a very simple feature.

Additional context

No response

pedrohba1 avatar Dec 15 '23 00:12 pedrohba1