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
impl Value
Sourcepub fn number(&self) -> Result<f64, ErrorKind>
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).
Sourcepub fn text(&self) -> Result<String, ErrorKind>
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.
Sourcepub fn truth(&self) -> Result<bool, ErrorKind>
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.
Sourcepub fn settled(self) -> Value
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.
Sourcepub fn spell(&self) -> String
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.
Sourcepub fn from_file(v: &Value) -> Option<Value>
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.