[][src]Struct comfy_table::Cell

pub struct Cell { /* fields omitted */ }

A stylable table cell with content.

Implementations

impl Cell[src]

pub fn new<T: ToString>(content: T) -> Self[src]

Create a new Cell

pub fn get_content(&self) -> String[src]

Return a copy of the content contained in this cell.

pub fn set_delimiter(mut self: Self, delimiter: char) -> Self[src]

Set the delimiter used to split text for this cell

pub fn set_alignment(mut self: Self, alignment: CellAlignment) -> Self[src]

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);

pub fn fg(mut self: Self, color: Color) -> Self[src]

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);

pub fn bg(mut self: Self, color: Color) -> Self[src]

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);

pub fn add_attribute(mut self: Self, attribute: Attribute) -> Self[src]

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);

pub fn add_attributes(mut self: Self, mut attribute: Vec<Attribute>) -> Self[src]

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

Trait Implementations

impl Clone for Cell[src]

impl Debug for Cell[src]

impl<T: ToString> From<T> for Cell[src]

pub fn from(content: T) -> Cell[src]

Convert to a new Cell.

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

impl ToCell for Cell[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<!> for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.