pub enum Cell {
Text(String),
Int(i64),
Float(f64),
Bool(bool),
Empty,
Date(i64),
Currency {
amount_cents: i64,
code: String,
},
Link {
label: String,
url: String,
},
Image {
uri: String,
},
Custom(Box<dyn CellRenderer>),
}Expand description
A single table cell value.
Variants§
Text(String)
Text cell.
Int(i64)
Integer cell.
Float(f64)
Floating-point cell.
Bool(bool)
Boolean cell.
Empty
Empty / null cell.
Date(i64)
Date cell, stored as Unix milliseconds since 1970-01-01 00:00:00 UTC.
Displayed as an ISO-8601 date string "YYYY-MM-DD".
Currency
Currency cell: an exact amount in the smallest currency unit (e.g. cents) together with a three-letter ISO-4217 currency code.
Displayed as "<major>.<minor02> <code>" (e.g. "123.45 EUR").
Fields
Link
Hyperlink cell: a display label and a URL.
The Display impl shows the label only.
Fields
Image
Image cell with a URI pointing to the image resource.
Displayed as "[image: <uri>]" in plain-text contexts.
Custom(Box<dyn CellRenderer>)
Custom cell backed by a CellRenderer implementation.
The renderer is heap-allocated and not Clone; cloning a Cell::Custom
is intentionally unsupported — wrap in Arc at the call site if needed.
Implementations§
Source§impl Cell
impl Cell
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if this cell is Cell::Empty.
Sourcepub fn compare(&self, other: &Cell) -> Ordering
pub fn compare(&self, other: &Cell) -> Ordering
Total ordering between two cells for sorting.
Same-typed cells compare naturally (numbers numerically, text
lexicographically, bools false < true). Floats use a total order where
NaN sorts last. Cross-type comparisons fall back to a stable rank so
sorting never panics: Empty < Bool < Int/Float < Text < Date < Currency < Link < Image < Custom.
Trait Implementations§
Source§impl CellRichExt for Cell
impl CellRichExt for Cell
Source§fn to_rich_cell(&self) -> RichCell
fn to_rich_cell(&self) -> RichCell
RichCell.Auto Trait Implementations§
impl !RefUnwindSafe for Cell
impl !Sync for Cell
impl !UnwindSafe for Cell
impl Freeze for Cell
impl Send for Cell
impl Unpin for Cell
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more