Skip to main content

Ctx

Struct Ctx 

Source
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 Library

Implementations§

Source§

impl<'a> Ctx<'a>

Source

pub fn new(env: &'a dyn Env, lib: &'a Library) -> Ctx<'a>

Source

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).

Source

pub fn eval<'e>(&self, e: &'e Expr) -> Result<Arg<'e>, Reason>

An expression as an operand.

Source

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.

Source

pub fn one(&self, arg: &Arg<'_>) -> Result<Value, Reason>

An operand as one value, by the same rule.

Source

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).

Source

pub fn truth_arg( &self, arg: &Arg<'_>, ) -> Result<Result<bool, ErrorKind>, Reason>

Ctx::truth over an evaluated operand.

Source

pub fn each<F>(&self, areas: &[Area], f: F) -> Result<(), Reason>
where F: FnMut(Value) -> 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).

Auto Trait Implementations§

§

impl<'a> !Freeze for Ctx<'a>

§

impl<'a> !RefUnwindSafe for Ctx<'a>

§

impl<'a> !Send for Ctx<'a>

§

impl<'a> !Sync for Ctx<'a>

§

impl<'a> !UnwindSafe for Ctx<'a>

§

impl<'a> Unpin for Ctx<'a>

§

impl<'a> UnsafeUnpin for Ctx<'a>

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