pub enum CellValue {
String(String),
Number(f64),
Integer(i64),
Boolean(bool),
DateTime(i64),
Empty,
}Expand description
A strongly-typed cell value that can represent different data types
This enum provides type safety for cell values, allowing the codebase to distinguish between strings, numbers, booleans, dates, and empty values. This eliminates the need for repeated string parsing and improves performance.
Variants§
String(String)
String data
Number(f64)
Numeric data (float)
Integer(i64)
Integer data (for exact precision when needed)
Boolean(bool)
Boolean data
DateTime(i64)
Date/time data (stored as timestamp)
Empty
Empty/null value
Implementations§
Source§impl CellValue
impl CellValue
Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Check if the value is numeric (Number or Integer)
Sourcepub fn as_number(&self) -> Option<f64>
pub fn as_number(&self) -> Option<f64>
Get the value as a number (f64)
Returns Some(f64) for Number and Integer values, None otherwise
Sourcepub fn to_display_string(&self) -> String
pub fn to_display_string(&self) -> String
Convert to display string
Sourcepub fn parse(s: &str) -> Self
pub fn parse(s: &str) -> Self
Parse a string into the most appropriate CellValue type
Attempts to parse the string as:
- Empty -> Empty
- Boolean (“true”/“false”) -> Boolean
- Integer -> Integer
- Float -> Number
- Otherwise -> String
Sourcepub fn from_string_with_type(s: &str, type_hint: Option<&DataType>) -> Self
pub fn from_string_with_type(s: &str, type_hint: Option<&DataType>) -> Self
Convert from string representation with type hint
Trait Implementations§
impl StructuralPartialEq for CellValue
Auto Trait Implementations§
impl Freeze for CellValue
impl RefUnwindSafe for CellValue
impl Send for CellValue
impl Sync for CellValue
impl Unpin for CellValue
impl UnsafeUnpin for CellValue
impl UnwindSafe for CellValue
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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