pub struct Cell<T> { /* private fields */ }
Expand description
Implementation of RawCell
that can specify styles.
Implementations§
Source§impl<T: RawCell> Cell<T>
impl<T: RawCell> Cell<T>
Sourcepub fn baseline(self, baseline: &str) -> impl Cells
pub fn baseline(self, baseline: &str) -> impl Cells
Return the cell with aligned baseline.
use text_grid::*;
struct Source(&'static str);
impl Cells for Source {
fn fmt(f: &mut CellsFormatter<Self>) {
f.column("default", |x| &x.0);
f.column("baseline", |x| cell(&x.0).baseline("-"));
}
}
let rows = [
Source("1-2345"),
Source("1234-5"),
Source("12345"),
];
let g = to_grid(rows);
assert_eq!(format!("\n{g}"), r#"
default | baseline |
---------|------------|
1-2345 | 1-2345 |
1234-5 | 1234-5 |
12345 | 12345 |
"#);
Sourcepub fn with_base_style(self, style: CellStyle) -> Self
pub fn with_base_style(self, style: CellStyle) -> Self
Return the cell with an empty style replaced by the specified style.
Judgment as to whether the style is empty or not is done for each individual element.
Trait Implementations§
Source§impl<T: RawCell> Cells for Cell<T>
impl<T: RawCell> Cells for Cell<T>
Source§fn fmt(f: &mut CellsFormatter<'_, '_, Self>)
fn fmt(f: &mut CellsFormatter<'_, '_, Self>)
Define columns. see
CellsFormatter
for details.Auto Trait Implementations§
impl<T> Freeze for Cell<T>where
T: Freeze,
impl<T> RefUnwindSafe for Cell<T>where
T: RefUnwindSafe,
impl<T> Send for Cell<T>where
T: Send,
impl<T> Sync for Cell<T>where
T: Sync,
impl<T> Unpin for Cell<T>where
T: Unpin,
impl<T> UnwindSafe for Cell<T>where
T: UnwindSafe,
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