zhiburt / tabled

An easy to use library for pretty print tables of Rust structs and enums.
MIT License
1.94k stars 77 forks source link

Builder::push_column cannot create new rows #391

Closed zxch3n closed 6 months ago

zxch3n commented 6 months ago

https://github.com/zhiburt/tabled/blob/4ab897e7e4e6449dd51d3297229f072702dfc49d/tabled/src/builder/table_builder.rs#L281-L290

In the above code, row is not inserted into the table

zhiburt commented 6 months ago

Hi @zxch3n

Indeed ....

I wonder how I missed that..............

Don't you wanna open a PR? If you try to, please create a small test see builder_test.rs.


Funnily there's one more issue there. Do you see it?

1, 2, 3....

Now I say

What if we pass an empty iterator Then the inner vector will not correspond to .count_columns.

We need to update it even with empty iterator.

zxch3n commented 6 months ago

Hi. I'll create a PR.

What if we pass an empty iterator Then the inner vector will not correspond to .count_columns.

What do you mean? It seems handled correctly by these code:

https://github.com/zhiburt/tabled/blob/4ab897e7e4e6449dd51d3297229f072702dfc49d/tabled/src/builder/table_builder.rs#L271-L279