Struct comfy_table::Cell[][src]

pub struct Cell { /* fields omitted */ }
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();

Performs the conversion.

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

Performs the conversion.

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.