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::{Table, settings::{object::Segment, Width, Style, Modify}};
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::{Table, settings::Width};
let table = Table::new(&["Hello World!"]).with(Width::increase(5));Implementations§
Source§impl<W> MinWidth<W>where
W: Measurement<Width>,
impl<W> MinWidth<W>where
W: Measurement<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 changing cells.
Sourcepub fn priority<PP: Peaker>(self, peacker: PP) -> MinWidth<W, PP>
pub fn priority<PP: Peaker>(self, peacker: PP) -> MinWidth<W, PP>
Priority defines the logic by which a increase of width will be applied when is done for the whole table.
PriorityNonewhich inc the columns one after another.PriorityMaxinc the biggest columns first.PriorityMininc the lowest columns first.
Trait Implementations§
Source§impl<W, R, P> CellOption<R, ColoredConfig> for MinWidth<W, P>where
W: Measurement<Width>,
R: Records + ExactRecords + PeekableRecords + RecordsMut<String>,
for<'a> &'a R: Records,
for<'a> <<&'a R as Records>::Iter as IntoRecords>::Cell: AsRef<str>,
impl<W, R, P> CellOption<R, ColoredConfig> for MinWidth<W, P>where
W: Measurement<Width>,
R: Records + ExactRecords + PeekableRecords + RecordsMut<String>,
for<'a> &'a R: Records,
for<'a> <<&'a R as Records>::Iter as IntoRecords>::Cell: AsRef<str>,
Source§fn change(self, records: &mut R, cfg: &mut ColoredConfig, entity: Entity)
fn change(self, records: &mut R, cfg: &mut ColoredConfig, entity: Entity)
Entity.Source§fn hint_change(&self) -> Option<Entity>
fn hint_change(&self) -> Option<Entity>
TableOption is going to change table layout. Read moreSource§impl<W: Ord, P: Ord> Ord for MinWidth<W, P>
impl<W: Ord, P: Ord> Ord for MinWidth<W, P>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<W: PartialOrd, P: PartialOrd> PartialOrd for MinWidth<W, P>
impl<W: PartialOrd, P: PartialOrd> PartialOrd for MinWidth<W, P>
Source§impl<W, P, R> TableOption<R, ColoredConfig, CompleteDimension> for MinWidth<W, P>where
W: Measurement<Width>,
P: Peaker,
R: Records + ExactRecords + PeekableRecords,
for<'a> &'a R: Records,
for<'a> <<&'a R as Records>::Iter as IntoRecords>::Cell: Cell + AsRef<str>,
impl<W, P, R> TableOption<R, ColoredConfig, CompleteDimension> for MinWidth<W, P>where
W: Measurement<Width>,
P: Peaker,
R: Records + ExactRecords + PeekableRecords,
for<'a> &'a R: Records,
for<'a> <<&'a R as Records>::Iter as IntoRecords>::Cell: Cell + AsRef<str>,
Source§fn change(
self,
records: &mut R,
cfg: &mut ColoredConfig,
dims: &mut CompleteDimension,
)
fn change( self, records: &mut R, cfg: &mut ColoredConfig, dims: &mut CompleteDimension, )
Source§fn hint_change(&self) -> Option<Entity>
fn hint_change(&self) -> Option<Entity>
TableOption is going to change table layout. Read more