pub struct MaxWidth;
Expand description

MaxWidth allows you to set a max width of an object on a Grid, using different strategies. It also allows you to set a MaxWidth for a whole table.

It is an abstract factory.

Beware that borders are not removed when you set a size value to very small. For example if you set size to 0 the table still be rendered but with all content removed.

Also be aware that it doesn’t changes crate::Padding settings.

The function is color aware if a color feature is on.

Examples

Cell change

use tabled::{object::Full, MaxWidth, Modify, Style, Table};

let data = ["Hello", "World", "!"];

let table = Table::new(&data)
    .with(Style::github_markdown())
    .with(Modify::new(Full).with(MaxWidth::truncating(3).suffix("...")));

Table change

use tabled::{MaxWidth, Table};

let table = Table::new(&["Hello World!"]).with(MaxWidth::wrapping(5));

Implementations

Returns a Truncate object.

Returns a Wrap object.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.