pub struct MinWidth<W = usize, P = PriorityNone> { /* private fields */ }
Expand description
MinWidth
changes a content in case if it’s length is lower then the boundary.
It can be applied to a whole table.
It does nothing in case if the content’s length is bigger then the boundary.
Be aware that further changes of the table may cause the width being not set.
For example applying Padding
after applying MinWidth
will make the former have no affect.
(You should use Padding
first).
Be aware that it doesn’t consider padding.
So if you want to set a exact width you might need to use Padding
to set it to 0.
§Examples
Cell change
use tabled::{object::Segment, Width, Modify, Style, Table};
let data = ["Hello", "World", "!"];
let table = Table::new(&data)
.with(Style::markdown())
.with(Modify::new(Segment::all()).with(Width::increase(10)));
Table change
use tabled::{Width, Table};
let table = Table::new(&["Hello World!"]).with(Width::increase(5));
Implementations§
Source§impl<W> MinWidth<W>where
W: Measurment<Width>,
impl<W> MinWidth<W>where
W: Measurment<Width>,
Source§impl<W, P> MinWidth<W, P>
impl<W, P> MinWidth<W, P>
Sourcepub fn fill_with(self, c: char) -> Self
pub fn fill_with(self, c: char) -> Self
Set’s a fill character which will be used to fill the space when increasing the length of the string to the set boundary.
Used only if chaning cells.
Sourcepub fn priority<PP: Peaker>(self) -> MinWidth<W, PP>
pub fn priority<PP: Peaker>(self) -> MinWidth<W, PP>
Priority defines the logic by which a increase of width will be applied when is done for the whole table.
PriorityNone
which inc the columns one after another.PriorityMax
inc the biggest columns first.PriorityMin
inc the lowest columns first.