pub struct Cell { /* private fields */ }
Expand description

A stylable table cell with content.

Implementations

Create a new Cell

Return a copy of the content contained in this cell.

Set the delimiter used to split text for this cell.
Normal text uses spaces ( ) as delimiters. This is necessary to help comfy-table understand the concept of words.

Set the alignment of content for this cell.

Setting this overwrites alignment settings of the Column for this specific cell.

use comfy_table::CellAlignment;
use comfy_table::Cell;

let mut cell = Cell::new("Some content")
    .set_alignment(CellAlignment::Center);

Set the foreground text color for this cell.

comfy-table uses Crossterm Colors. Look at their documentation for all possible Colors.

use comfy_table::Color;
use comfy_table::Cell;

let mut cell = Cell::new("Some content")
    .fg(Color::Red);

Set the background color for this cell.

comfy-table uses Crossterm Colors. Look at their documentation for all possible Colors.

use comfy_table::Color;
use comfy_table::Cell;

let mut cell = Cell::new("Some content")
    .bg(Color::Red);

Add a styling attribute to the content cell.
Those can be bold, italic, blinking and many more.

comfy-table uses Crossterm Attributes. Look at their documentation for all possible Attributes.

use comfy_table::Attribute;
use comfy_table::Cell;

let mut cell = Cell::new("Some content")
    .add_attribute(Attribute::Bold);

Same as add_attribute, but you can pass a vector of Attributes

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Convert anything with ToString to a new Cell.

let cell: Cell = "content".into();
let cell: Cell = 5u32.into();

Converts to this type from the input type.

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

Converts to this type from the input type.

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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

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.