pub struct Justify<W> { /* private fields */ }
Available on crate feature
std
only.Expand description
Justify sets all columns widths to the set value.
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
use tabled::{Table, settings::{Width, Style, object::Segment, Padding, Modify}};
let data = ["Hello", "World", "!"];
let table = Table::new(&data)
.with(Style::markdown())
.with(Modify::new(Segment::all()).with(Padding::zero()))
.with(Width::justify(3));
Max
usage to justify by a max column width.
use tabled::{Table, settings::{width::Justify, Style}};
let data = ["Hello", "World", "!"];
let table = Table::new(&data)
.with(Style::markdown())
.with(Justify::max());
Implementations§
Trait Implementations§
source§impl<W: Ord> Ord for Justify<W>
impl<W: Ord> Ord for Justify<W>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<W: PartialEq> PartialEq for Justify<W>
impl<W: PartialEq> PartialEq for Justify<W>
source§impl<W: PartialOrd> PartialOrd for Justify<W>
impl<W: PartialOrd> PartialOrd for Justify<W>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<R, D, W> TableOption<R, ColoredConfig, D> for Justify<W>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<R, D, W> TableOption<R, ColoredConfig, D> for Justify<W>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, _: &mut D)
fn change(self, records: &mut R, cfg: &mut ColoredConfig, _: &mut D)
The function modificaties of records and a grid configuration.
source§fn hint_change(&self) -> Option<Entity>
fn hint_change(&self) -> Option<Entity>
A hint whether an
TableOption
is going to change table layout. Read moreimpl<W: Copy> Copy for Justify<W>
impl<W: Eq> Eq for Justify<W>
impl<W> StructuralEq for Justify<W>
impl<W> StructuralPartialEq for Justify<W>
Auto Trait Implementations§
impl<W> RefUnwindSafe for Justify<W>where
W: RefUnwindSafe,
impl<W> Send for Justify<W>where
W: Send,
impl<W> Sync for Justify<W>where
W: Sync,
impl<W> Unpin for Justify<W>where
W: Unpin,
impl<W> UnwindSafe for Justify<W>where
W: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more