pub struct Ctx<'a> {
pub env: &'a dyn Env,
pub lib: &'a Library,
/* private fields */
}Expand description
One cell’s evaluation: the environment and the library.
Fields§
§env: &'a dyn Env§lib: &'a LibraryImplementations§
Source§impl<'a> Ctx<'a>
impl<'a> Ctx<'a>
pub fn new(env: &'a dyn Env, lib: &'a Library) -> Ctx<'a>
Sourcepub fn at(env: &'a dyn Env, lib: &'a Library, d_row: i64, d_col: i64) -> Ctx<'a>
pub fn at(env: &'a dyn Env, lib: &'a Library, d_row: i64, d_col: i64) -> Ctx<'a>
An evaluation of a formula read at another cell, d_row rows up and
d_col columns left of the cell being computed: every reference the
formula writes is moved by that much, as a filled formula’s are, and
the references inside a defined name’s text are not, since a name
does not move with the cell that reads it (KERNEL.22).
Sourcepub fn scalar(&self, e: &Expr) -> Result<Value, Reason>
pub fn scalar(&self, e: &Expr) -> Result<Value, Reason>
An expression as one value: a scalar, or a reference to one cell; a reference to more is a construct this slice does not read.
Sourcepub fn one(&self, arg: &Arg<'_>) -> Result<Value, Reason>
pub fn one(&self, arg: &Arg<'_>) -> Result<Value, Reason>
An operand as one value, by the same rule.
Sourcepub fn truth(&self, e: &Expr) -> Result<Result<bool, ErrorKind>, Reason>
pub fn truth(&self, e: &Expr) -> Result<Result<bool, ErrorKind>, Reason>
A condition as IF, IFS and NOT read one: the operand as one
value, then its truth value (Value::truth), a text read through a
reference coerced as a typed one is. Measured: Excel’s save of the
subset fixture computes IF(A6,1,2) over the text TRUE as 1, and
over the text x as #VALUE! (scripts/recalc/subset_saved.xlsx,
logic!C6 and C3). AND and OR read a reference as a range
instead, skipping its texts (logic!C13).
Sourcepub fn truth_arg(
&self,
arg: &Arg<'_>,
) -> Result<Result<bool, ErrorKind>, Reason>
pub fn truth_arg( &self, arg: &Arg<'_>, ) -> Result<Result<bool, ErrorKind>, Reason>
Ctx::truth over an evaluated operand.
Sourcepub fn each<F>(&self, areas: &[Area], f: F) -> Result<(), Reason>
pub fn each<F>(&self, areas: &[Area], f: F) -> Result<(), Reason>
Every cell the areas hold, in area order then row-major, to f;
a cell nothing holds is skipped, as Excel skips it in a range. f is
a type of its own and not a pointer, so that an aggregate’s fold is
compiled into the walk (KERNEL.25). A sheet the environment keeps as
an array is walked by index, the same values in the same order
(KERNEL.20).