pub struct Cell { /* private fields */ }
Expand description
A stylable table cell with content.
Implementations§
Source§impl Cell
impl Cell
Sourcepub fn set_delimiter(self, delimiter: char) -> Self
pub fn set_delimiter(self, delimiter: char) -> Self
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) -> Self
pub fn set_alignment(self, alignment: CellAlignment) -> Self
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);
Sourcepub fn fg(self, color: Color) -> Self
pub fn fg(self, color: Color) -> Self
Set the foreground text color for this cell.
Look at Color for a list of all possible Colors.
use comfy_table::Color;
use comfy_table::Cell;
let mut cell = Cell::new("Some content")
.fg(Color::Red);
Sourcepub fn bg(self, color: Color) -> Self
pub fn bg(self, color: Color) -> Self
Set the background color for this cell.
Look at Color for a list of all possible Colors.
use comfy_table::Color;
use comfy_table::Cell;
let mut cell = Cell::new("Some content")
.bg(Color::Red);
Sourcepub fn add_attribute(self, attribute: Attribute) -> Self
pub fn add_attribute(self, attribute: Attribute) -> Self
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;
use comfy_table::Cell;
let mut cell = Cell::new("Some content")
.add_attribute(Attribute::Bold);
Sourcepub fn add_attributes(self, attribute: Vec<Attribute>) -> Self
pub fn add_attributes(self, attribute: Vec<Attribute>) -> Self
Same as add_attribute, but you can pass a vector of Attributes
Trait Implementations§
Source§impl<T: ToString> From<T> for Cell
impl<T: ToString> From<T> for Cell
impl Eq for Cell
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)