Enum spreadsheet_ods::Value
source · pub enum Value {
Empty,
Boolean(bool),
Number(f64),
Percentage(f64),
Currency(f64, Box<str>),
Text(String),
TextXml(Vec<TextTag>),
DateTime(NaiveDateTime),
TimeDuration(Duration),
}
Expand description
Content-Values
Variants§
Empty
Boolean(bool)
Number(f64)
Percentage(f64)
Currency(f64, Box<str>)
Text(String)
TextXml(Vec<TextTag>)
DateTime(NaiveDateTime)
TimeDuration(Duration)
Implementations§
source§impl Value
impl Value
sourcepub fn value_type(&self) -> ValueType
pub fn value_type(&self) -> ValueType
Return the plan ValueType for this value.
sourcepub fn as_bool_or(&self, d: bool) -> bool
pub fn as_bool_or(&self, d: bool) -> bool
Return the bool if the value is a Boolean. Default otherwise.
sourcepub fn as_i64_or(&self, d: i64) -> i64
pub fn as_i64_or(&self, d: i64) -> i64
Return the content as i64 if the value is a number, percentage or currency. Default otherwise.
sourcepub fn as_i64_opt(&self) -> Option<i64>
pub fn as_i64_opt(&self) -> Option<i64>
Return the content as i64 if the value is a number, percentage or currency.
sourcepub fn as_u64_or(&self, d: u64) -> u64
pub fn as_u64_or(&self, d: u64) -> u64
Return the content as u64 if the value is a number, percentage or currency. Default otherwise.
sourcepub fn as_u64_opt(&self) -> Option<u64>
pub fn as_u64_opt(&self) -> Option<u64>
Return the content as u64 if the value is a number, percentage or currency.
sourcepub fn as_i32_or(&self, d: i32) -> i32
pub fn as_i32_or(&self, d: i32) -> i32
Return the content as i32 if the value is a number, percentage or currency. Default otherwise.
sourcepub fn as_i32_opt(&self) -> Option<i32>
pub fn as_i32_opt(&self) -> Option<i32>
Return the content as i32 if the value is a number, percentage or currency.
sourcepub fn as_u32_or(&self, d: u32) -> u32
pub fn as_u32_or(&self, d: u32) -> u32
Return the content as u32 if the value is a number, percentage or currency. Default otherwise.
sourcepub fn as_u32_opt(&self) -> Option<u32>
pub fn as_u32_opt(&self) -> Option<u32>
Return the content as u32 if the value is a number, percentage or currency.
sourcepub fn as_i16_or(&self, d: i16) -> i16
pub fn as_i16_or(&self, d: i16) -> i16
Return the content as i16 if the value is a number, percentage or currency. Default otherwise.
sourcepub fn as_i16_opt(&self) -> Option<i16>
pub fn as_i16_opt(&self) -> Option<i16>
Return the content as i16 if the value is a number, percentage or currency.
sourcepub fn as_u16_or(&self, d: u16) -> u16
pub fn as_u16_or(&self, d: u16) -> u16
Return the content as u16 if the value is a number, percentage or currency. Default otherwise.
sourcepub fn as_u16_opt(&self) -> Option<u16>
pub fn as_u16_opt(&self) -> Option<u16>
Return the content as u16 if the value is a number, percentage or currency.
sourcepub fn as_i8_or(&self, d: i8) -> i8
pub fn as_i8_or(&self, d: i8) -> i8
Return the content as i8 if the value is a number, percentage or currency. Default otherwise.
sourcepub fn as_i8_opt(&self) -> Option<i8>
pub fn as_i8_opt(&self) -> Option<i8>
Return the content as i8 if the value is a number, percentage or currency.
sourcepub fn as_u8_or(&self, d: u8) -> u8
pub fn as_u8_or(&self, d: u8) -> u8
Return the content as u8 if the value is a number, percentage or currency. Default otherwise.
sourcepub fn as_u8_opt(&self) -> Option<u8>
pub fn as_u8_opt(&self) -> Option<u8>
Return the content as u8 if the value is a number, percentage or currency.
sourcepub fn as_decimal_or(&self, d: Decimal) -> Decimal
pub fn as_decimal_or(&self, d: Decimal) -> Decimal
Return the content as decimal if the value is a number, percentage or currency. Default otherwise.
sourcepub fn as_decimal_opt(&self) -> Option<Decimal>
pub fn as_decimal_opt(&self) -> Option<Decimal>
Return the content as decimal if the value is a number, percentage or currency. Default otherwise.
sourcepub fn as_f64_or(&self, d: f64) -> f64
pub fn as_f64_or(&self, d: f64) -> f64
Return the content as f64 if the value is a number, percentage or currency. Default otherwise.
sourcepub fn as_f64_opt(&self) -> Option<f64>
pub fn as_f64_opt(&self) -> Option<f64>
Return the content as f64 if the value is a number, percentage or currency.
sourcepub fn as_str_or<'a>(&'a self, d: &'a str) -> &'a str
pub fn as_str_or<'a>(&'a self, d: &'a str) -> &'a str
Return the content as str if the value is text.
sourcepub fn as_cow_str_or<'a>(&'a self, d: &'a str) -> Cow<'a, str>
pub fn as_cow_str_or<'a>(&'a self, d: &'a str) -> Cow<'a, str>
Return the content as str if the value is text or markup text. When the cell contains markup all the markup is removed, but line-breaks are kept as \n.
sourcepub fn as_str_opt(&self) -> Option<&str>
pub fn as_str_opt(&self) -> Option<&str>
Return the content as str if the value is text.
sourcepub fn as_timeduration_or(&self, d: Duration) -> Duration
pub fn as_timeduration_or(&self, d: Duration) -> Duration
Return the content as Duration if the value is a TimeDuration. Default otherwise.
sourcepub fn as_timeduration_opt(&self) -> Option<Duration>
pub fn as_timeduration_opt(&self) -> Option<Duration>
Return the content as Duration if the value is a TimeDuration. Default otherwise.
sourcepub fn as_datetime_or(&self, d: NaiveDateTime) -> NaiveDateTime
pub fn as_datetime_or(&self, d: NaiveDateTime) -> NaiveDateTime
Return the content as NaiveDateTime if the value is a DateTime. Default otherwise.
sourcepub fn as_datetime_opt(&self) -> Option<NaiveDateTime>
pub fn as_datetime_opt(&self) -> Option<NaiveDateTime>
Return the content as an optional NaiveDateTime if the value is a DateTime.
sourcepub fn as_date_or(&self, d: NaiveDate) -> NaiveDate
pub fn as_date_or(&self, d: NaiveDate) -> NaiveDate
Return the content as NaiveDate if the value is a DateTime. Default otherwise.
sourcepub fn as_date_opt(&self) -> Option<NaiveDate>
pub fn as_date_opt(&self) -> Option<NaiveDate>
Return the content as an optional NaiveDateTime if the value is a DateTime.
sourcepub fn new_currency<S: AsRef<str>>(cur: S, value: f64) -> Self
pub fn new_currency<S: AsRef<str>>(cur: S, value: f64) -> Self
Create a currency value.
sourcepub fn new_percentage(value: f64) -> Self
pub fn new_percentage(value: f64) -> Self
Create a percentage value.
Trait Implementations§
source§impl From<NaiveDateTime> for Value
impl From<NaiveDateTime> for Value
source§fn from(dt: NaiveDateTime) -> Self
fn from(dt: NaiveDateTime) -> Self
source§impl From<Option<NaiveDateTime>> for Value
impl From<Option<NaiveDateTime>> for Value
source§fn from(dt: Option<NaiveDateTime>) -> Self
fn from(dt: Option<NaiveDateTime>) -> Self
source§impl GetSize for Value
impl GetSize for Value
source§fn get_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
source§fn get_stack_size() -> usize
fn get_stack_size() -> usize
source§impl PartialEq for Value
impl PartialEq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)