pub struct Cell { /* private fields */ }Available on crate feature
table only.Expand description
A stylable table cell with content.
Implementations§
Source§impl Cell
impl Cell
Sourcepub fn set_delimiter(self, delimiter: char) -> Cell
pub fn set_delimiter(self, delimiter: char) -> 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.
Sourcepub fn set_alignment(self, alignment: CellAlignment) -> Cell
pub fn set_alignment(self, alignment: CellAlignment) -> Cell
Set the alignment of content for this cell.
Setting this overwrites alignment settings of the Column for this specific cell.
use comfy_table::{Cell, CellAlignment};
let mut cell = Cell::new("Some content").set_alignment(CellAlignment::Center);Sourcepub fn fg(self, color: Color) -> Cell
Available on crate feature tty only.
pub fn fg(self, color: Color) -> Cell
tty only.Set the foreground text color for this cell.
Look at Color for a list of all possible Colors.
use comfy_table::{Cell, Color};
let mut cell = Cell::new("Some content").fg(Color::Red);Sourcepub fn bg(self, color: Color) -> Cell
Available on crate feature tty only.
pub fn bg(self, color: Color) -> Cell
tty only.Set the background color for this cell.
Look at Color for a list of all possible Colors.
use comfy_table::{Cell, Color};
let mut cell = Cell::new("Some content").bg(Color::Red);Sourcepub fn add_attribute(self, attribute: Attribute) -> Cell
Available on crate feature tty only.
pub fn add_attribute(self, attribute: Attribute) -> Cell
tty only.Add a styling attribute to the content cell.
Those can be bold, italic, blinking and many more.
Look at Attribute for a list of all possible Colors.
use comfy_table::{Attribute, Cell};
let mut cell = Cell::new("Some content").add_attribute(Attribute::Bold);Sourcepub fn add_attributes(self, attribute: Vec<Attribute>) -> Cell
Available on crate feature tty only.
pub fn add_attributes(self, attribute: Vec<Attribute>) -> Cell
tty only.Same as add_attribute, but you can pass a vector of Attributes
Trait Implementations§
impl Eq for Cell
Source§impl<T> From<T> for Cellwhere
T: ToString,
impl<T> From<T> for Cellwhere
T: ToString,
let cell: Cell = "content".into();
let cell: Cell = 5u32.into();impl StructuralPartialEq for Cell
Auto Trait Implementations§
impl Freeze for Cell
impl RefUnwindSafe for Cell
impl Send for Cell
impl Sync for Cell
impl Unpin for Cell
impl UnsafeUnpin for Cell
impl UnwindSafe for Cell
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more