pub struct Cell {
pub content: Text,
pub style: Option<Style>,
}Expand description
A table cell.
Fields§
§content: TextCell content.
style: Option<Style>Cell-specific style (overrides column style).
Implementations§
Source§impl Cell
impl Cell
Sourcepub fn new(content: impl Into<Text>) -> Self
pub fn new(content: impl Into<Text>) -> Self
Create a new cell with plain text content.
This method does NOT parse Rich markup syntax. If you pass "[bold]text[/]",
the literal string "[bold]text[/]" will be displayed in the cell.
Use Cell::from_markup if you want to parse Rich markup tags.
§Examples
use rich_rust::renderables::table::Cell;
// Plain text - markup is NOT parsed
let cell = Cell::new("[bold]text[/]");
assert_eq!(cell.content.plain(), "[bold]text[/]"); // Literal text
// Compare with from_markup which DOES parse:
let styled_cell = Cell::from_markup("[bold]text[/]");
assert_eq!(styled_cell.content.plain(), "text"); // Markup removedSourcepub fn from_markup(content: &str) -> Self
pub fn from_markup(content: &str) -> Self
Create a new cell from markup string.
This parses Rich markup syntax like [bold]text[/] or [red]colored[/].
§Examples
use rich_rust::renderables::table::Cell;
// Styled cell using markup
let cell = Cell::from_markup("[bold green]Success[/]");
// Mixed markup
let cell = Cell::from_markup("Status: [red]FAIL[/]");Trait Implementations§
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