[][src]Struct comfy_table::Cell

pub struct Cell { /* fields omitted */ }

A stylable table cell with content.

Methods

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_alignment(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(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(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(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(self, 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]

Auto Trait Implementations

impl RefUnwindSafe for Cell

impl Send for Cell

impl Sync for Cell

impl Unpin for Cell

impl UnwindSafe for Cell

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<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.