Skip to main content

Value

Enum Value 

Source
pub enum Value {
    Number(f64),
    Text(String),
    Bool(bool),
    Error(ErrorKind),
    Empty,
}
Expand description

What a cell holds or a formula computes.

Variants§

§

Number(f64)

§

Text(String)

§

Bool(bool)

§

Error(ErrorKind)

§

Empty

A cell with nothing in it. An operand that is empty reads as 0, as "" or as FALSE, whichever the operator wants; a formula whose result is empty settles to 0 (Value::settled).

Implementations§

Source§

impl Value

Source

pub fn number(&self) -> Result<f64, ErrorKind>

The number an arithmetic operator reads: a number itself; a truth value 1 or 0; an empty cell 0; a text its number when it spells one ("5", " 1e3 ", "50%") and #VALUE! otherwise; an error the error. Excel’s rule for +, -, *, /, ^ and a function’s numeric argument given directly (a value read out of a range follows the range rule instead, which each function states).

Source

pub fn text(&self) -> Result<String, ErrorKind>

The text & reads: a text itself; a number in Excel’s General spelling (number_to_text); a truth value TRUE or FALSE; an empty cell ""; an error the error.

Source

pub fn truth(&self) -> Result<bool, ErrorKind>

The truth value IF, AND, OR and NOT read: a truth value itself; a number true unless 0; an empty cell false; a text only when it spells TRUE or FALSE, #VALUE! otherwise; an error the error.

Source

pub fn settled(self) -> Value

A formula’s result as its cell holds it: an empty result is 0, as =A1 over an empty A1 shows 0 and is a number to ISNUMBER.

Source

pub fn spell(&self) -> String

The value as a datum, spelled as a cell row spells one (crate::rows::datum): a number in its shortest spelling, a text quoted, true or false, (error "#DIV/0!"); a number no cell can hold is #NUM!, as the writer spells it; an empty value is 0.

Source

pub fn from_file(v: &Value) -> Option<Value>

A cached value as the file holds it, read as a computed kind: the file’s number text parsed, a text, a truth value, one of the seven errors. None for a value this version does not compare: a date cell, a number text that is not a number, an error outside the seven.

Trait Implementations§

Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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<(), Error>

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

impl PartialEq for Value

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

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 UnsafeUnpin 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.