Skip to main content

DataType

Trait DataType 

Source
pub trait DataType {
Show 24 methods // Required methods fn is_empty(&self) -> bool; fn is_int(&self) -> bool; fn is_float(&self) -> bool; fn is_bool(&self) -> bool; fn is_string(&self) -> bool; fn is_error(&self) -> bool; fn is_duration_iso(&self) -> bool; fn is_datetime(&self) -> bool; fn is_datetime_iso(&self) -> bool; fn get_int(&self) -> Option<i64>; fn get_float(&self) -> Option<f64>; fn get_bool(&self) -> Option<bool>; fn get_string(&self) -> Option<&str>; fn get_datetime(&self) -> Option<ExcelDateTime>; fn get_datetime_iso(&self) -> Option<&str>; fn get_duration_iso(&self) -> Option<&str>; fn get_error(&self) -> Option<&CellErrorType>; fn as_string(&self) -> Option<String>; fn as_i64(&self) -> Option<i64>; fn as_f64(&self) -> Option<f64>; // Provided methods fn as_date(&self) -> Option<NaiveDate> { ... } fn as_time(&self) -> Option<NaiveTime> { ... } fn as_duration(&self) -> Option<Duration> { ... } fn as_datetime(&self) -> Option<NaiveDateTime> { ... }
}
Expand description

A trait to represent all different data types that can appear as a value in a worksheet cell

Required Methods§

Source

fn is_empty(&self) -> bool

Assess if datatype is empty

Source

fn is_int(&self) -> bool

Assess if datatype is a int

Source

fn is_float(&self) -> bool

Assess if datatype is a float

Source

fn is_bool(&self) -> bool

Assess if datatype is a bool

Source

fn is_string(&self) -> bool

Assess if datatype is a string

Source

fn is_error(&self) -> bool

Assess if datatype is a CellErrorType

Source

fn is_duration_iso(&self) -> bool

Assess if datatype is an ISO8601 duration

Source

fn is_datetime(&self) -> bool

Assess if datatype is a datetime

Source

fn is_datetime_iso(&self) -> bool

Assess if datatype is an ISO8601 datetime

Source

fn get_int(&self) -> Option<i64>

Try getting int value

Source

fn get_float(&self) -> Option<f64>

Try getting float value

Source

fn get_bool(&self) -> Option<bool>

Try getting bool value

Source

fn get_string(&self) -> Option<&str>

Try getting string value

Source

fn get_datetime(&self) -> Option<ExcelDateTime>

Try getting datetime value

Source

fn get_datetime_iso(&self) -> Option<&str>

Try getting datetime ISO8601 value

Source

fn get_duration_iso(&self) -> Option<&str>

Try getting duration ISO8601 value

Source

fn get_error(&self) -> Option<&CellErrorType>

Try getting Error value

Source

fn as_string(&self) -> Option<String>

Try converting data type into a string

Source

fn as_i64(&self) -> Option<i64>

Try converting data type into an int

Source

fn as_f64(&self) -> Option<f64>

Try converting data type into a float

Provided Methods§

Source

fn as_date(&self) -> Option<NaiveDate>

Available on crate feature chrono only.

Try converting data type into a date

Source

fn as_time(&self) -> Option<NaiveTime>

Available on crate feature chrono only.

Try converting data type into a time

Source

fn as_duration(&self) -> Option<Duration>

Available on crate feature chrono only.

Try converting data type into a duration

Source

fn as_datetime(&self) -> Option<NaiveDateTime>

Available on crate feature chrono only.

Implementors§

Source§

impl DataType for Data

An enum to represent all different data types that can appear as a value in a worksheet cell

Source§

impl DataType for DataRef<'_>