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

source

pub fn value_type(&self) -> ValueType

Return the plan ValueType for this value.

source

pub fn as_bool_or(&self, d: bool) -> bool

Return the bool if the value is a Boolean. Default otherwise.

source

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.

source

pub fn as_i64_opt(&self) -> Option<i64>

Return the content as i64 if the value is a number, percentage or currency.

source

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.

source

pub fn as_u64_opt(&self) -> Option<u64>

Return the content as u64 if the value is a number, percentage or currency.

source

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.

source

pub fn as_i32_opt(&self) -> Option<i32>

Return the content as i32 if the value is a number, percentage or currency.

source

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.

source

pub fn as_u32_opt(&self) -> Option<u32>

Return the content as u32 if the value is a number, percentage or currency.

source

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.

source

pub fn as_i16_opt(&self) -> Option<i16>

Return the content as i16 if the value is a number, percentage or currency.

source

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.

source

pub fn as_u16_opt(&self) -> Option<u16>

Return the content as u16 if the value is a number, percentage or currency.

source

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.

source

pub fn as_i8_opt(&self) -> Option<i8>

Return the content as i8 if the value is a number, percentage or currency.

source

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.

source

pub fn as_u8_opt(&self) -> Option<u8>

Return the content as u8 if the value is a number, percentage or currency.

source

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.

source

pub fn as_decimal_opt(&self) -> Option<Decimal>

Return the content as decimal if the value is a number, percentage or currency. Default otherwise.

source

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.

source

pub fn as_f64_opt(&self) -> Option<f64>

Return the content as f64 if the value is a number, percentage or currency.

source

pub fn as_str_or<'a>(&'a self, d: &'a str) -> &'a str

Return the content as str if the value is text.

source

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.

source

pub fn as_str_opt(&self) -> Option<&str>

Return the content as str if the value is text.

source

pub fn as_timeduration_or(&self, d: Duration) -> Duration

Return the content as Duration if the value is a TimeDuration. Default otherwise.

source

pub fn as_timeduration_opt(&self) -> Option<Duration>

Return the content as Duration if the value is a TimeDuration. Default otherwise.

source

pub fn as_datetime_or(&self, d: NaiveDateTime) -> NaiveDateTime

Return the content as NaiveDateTime if the value is a DateTime. Default otherwise.

source

pub fn as_datetime_opt(&self) -> Option<NaiveDateTime>

Return the content as an optional NaiveDateTime if the value is a DateTime.

source

pub fn as_date_or(&self, d: NaiveDate) -> NaiveDate

Return the content as NaiveDate if the value is a DateTime. Default otherwise.

source

pub fn as_date_opt(&self) -> Option<NaiveDate>

Return the content as an optional NaiveDateTime if the value is a DateTime.

source

pub fn currency(&self) -> &str

Returns the currency code or “” if the value is not a currency.

source

pub fn new_currency<S: AsRef<str>>(cur: S, value: f64) -> Self

Create a currency value.

source

pub fn new_percentage(value: f64) -> Self

Create a percentage value.

Trait Implementations§

source§

impl Clone for Value

source§

fn clone(&self) -> Value

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Value

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Value

source§

fn default() -> Value

Returns the “default value” for a type. Read more
source§

impl From<&String> for Value

source§

fn from(s: &String) -> Self

Converts to this type from the input type.
source§

impl From<&f32> for Value

source§

fn from(f: &f32) -> Self

Converts to this type from the input type.
source§

impl From<&f64> for Value

source§

fn from(f: &f64) -> Self

Converts to this type from the input type.
source§

impl From<&i16> for Value

source§

fn from(f: &i16) -> Self

Converts to this type from the input type.
source§

impl From<&i32> for Value

source§

fn from(f: &i32) -> Self

Converts to this type from the input type.
source§

impl From<&i64> for Value

source§

fn from(f: &i64) -> Self

Converts to this type from the input type.
source§

impl From<&i8> for Value

source§

fn from(f: &i8) -> Self

Converts to this type from the input type.
source§

impl From<&str> for Value

source§

fn from(s: &str) -> Self

Converts to this type from the input type.
source§

impl From<&u16> for Value

source§

fn from(f: &u16) -> Self

Converts to this type from the input type.
source§

impl From<&u32> for Value

source§

fn from(f: &u32) -> Self

Converts to this type from the input type.
source§

impl From<&u64> for Value

source§

fn from(f: &u64) -> Self

Converts to this type from the input type.
source§

impl From<&u8> for Value

source§

fn from(f: &u8) -> Self

Converts to this type from the input type.
source§

impl From<()> for Value

source§

fn from(_: ()) -> Self

Converts to this type from the input type.
source§

impl From<Decimal> for Value

source§

fn from(f: Decimal) -> Self

Converts to this type from the input type.
source§

impl From<NaiveDate> for Value

source§

fn from(dt: NaiveDate) -> Self

Converts to this type from the input type.
source§

impl From<NaiveDateTime> for Value

source§

fn from(dt: NaiveDateTime) -> Self

Converts to this type from the input type.
source§

impl From<NaiveTime> for Value

source§

fn from(ti: NaiveTime) -> Self

Converts to this type from the input type.
source§

impl From<Option<&String>> for Value

source§

fn from(s: Option<&String>) -> Self

Converts to this type from the input type.
source§

impl From<Option<&f32>> for Value

source§

fn from(f: Option<&f32>) -> Self

Converts to this type from the input type.
source§

impl From<Option<&f64>> for Value

source§

fn from(f: Option<&f64>) -> Self

Converts to this type from the input type.
source§

impl From<Option<&i16>> for Value

source§

fn from(f: Option<&i16>) -> Self

Converts to this type from the input type.
source§

impl From<Option<&i32>> for Value

source§

fn from(f: Option<&i32>) -> Self

Converts to this type from the input type.
source§

impl From<Option<&i64>> for Value

source§

fn from(f: Option<&i64>) -> Self

Converts to this type from the input type.
source§

impl From<Option<&i8>> for Value

source§

fn from(f: Option<&i8>) -> Self

Converts to this type from the input type.
source§

impl From<Option<&str>> for Value

source§

fn from(s: Option<&str>) -> Self

Converts to this type from the input type.
source§

impl From<Option<&u16>> for Value

source§

fn from(f: Option<&u16>) -> Self

Converts to this type from the input type.
source§

impl From<Option<&u32>> for Value

source§

fn from(f: Option<&u32>) -> Self

Converts to this type from the input type.
source§

impl From<Option<&u64>> for Value

source§

fn from(f: Option<&u64>) -> Self

Converts to this type from the input type.
source§

impl From<Option<&u8>> for Value

source§

fn from(f: Option<&u8>) -> Self

Converts to this type from the input type.
source§

impl From<Option<Decimal>> for Value

source§

fn from(f: Option<Decimal>) -> Self

Converts to this type from the input type.
source§

impl From<Option<NaiveDate>> for Value

source§

fn from(dt: Option<NaiveDate>) -> Self

Converts to this type from the input type.
source§

impl From<Option<NaiveDateTime>> for Value

source§

fn from(dt: Option<NaiveDateTime>) -> Self

Converts to this type from the input type.
source§

impl From<Option<NaiveTime>> for Value

source§

fn from(dt: Option<NaiveTime>) -> Self

Converts to this type from the input type.
source§

impl From<Option<String>> for Value

source§

fn from(s: Option<String>) -> Self

Converts to this type from the input type.
source§

impl From<Option<TimeDelta>> for Value

source§

fn from(d: Option<Duration>) -> Self

Converts to this type from the input type.
source§

impl From<Option<bool>> for Value

source§

fn from(b: Option<bool>) -> Self

Converts to this type from the input type.
source§

impl From<Option<f32>> for Value

source§

fn from(f: Option<f32>) -> Self

Converts to this type from the input type.
source§

impl From<Option<f64>> for Value

source§

fn from(f: Option<f64>) -> Self

Converts to this type from the input type.
source§

impl From<Option<i16>> for Value

source§

fn from(f: Option<i16>) -> Self

Converts to this type from the input type.
source§

impl From<Option<i32>> for Value

source§

fn from(f: Option<i32>) -> Self

Converts to this type from the input type.
source§

impl From<Option<i64>> for Value

source§

fn from(f: Option<i64>) -> Self

Converts to this type from the input type.
source§

impl From<Option<i8>> for Value

source§

fn from(f: Option<i8>) -> Self

Converts to this type from the input type.
source§

impl From<Option<u16>> for Value

source§

fn from(f: Option<u16>) -> Self

Converts to this type from the input type.
source§

impl From<Option<u32>> for Value

source§

fn from(f: Option<u32>) -> Self

Converts to this type from the input type.
source§

impl From<Option<u64>> for Value

source§

fn from(f: Option<u64>) -> Self

Converts to this type from the input type.
source§

impl From<Option<u8>> for Value

source§

fn from(f: Option<u8>) -> Self

Converts to this type from the input type.
source§

impl From<String> for Value

source§

fn from(s: String) -> Self

Converts to this type from the input type.
source§

impl From<TimeDelta> for Value

source§

fn from(d: Duration) -> Self

Converts to this type from the input type.
source§

impl From<Vec<XmlTag>> for Value

source§

fn from(t: Vec<TextTag>) -> Self

Converts to this type from the input type.
source§

impl From<XmlTag> for Value

source§

fn from(t: TextTag) -> Self

Converts to this type from the input type.
source§

impl From<bool> for Value

source§

fn from(b: bool) -> Self

Converts to this type from the input type.
source§

impl From<f32> for Value

source§

fn from(f: f32) -> Self

Converts to this type from the input type.
source§

impl From<f64> for Value

source§

fn from(f: f64) -> Self

Converts to this type from the input type.
source§

impl From<i16> for Value

source§

fn from(f: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Value

source§

fn from(f: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for Value

source§

fn from(f: i64) -> Self

Converts to this type from the input type.
source§

impl From<i8> for Value

source§

fn from(f: i8) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Value

source§

fn from(f: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Value

source§

fn from(f: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Value

source§

fn from(f: u64) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Value

source§

fn from(f: u8) -> Self

Converts to this type from the input type.
source§

impl GetSize for Value

source§

fn get_heap_size(&self) -> usize

Determines how many bytes this object occupies inside the heap. Read more
source§

fn get_stack_size() -> usize

Determines how may bytes this object occupies inside the stack. Read more
source§

fn get_size(&self) -> usize

Determines the total size of the object. Read more
source§

impl PartialEq for Value

source§

fn eq(&self, other: &Value) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Value

Auto Trait Implementations§

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.