Skip to main content

Host

Trait Host 

Source
pub trait Host {
    // Required methods
    fn workbook(&self) -> &Workbook;
    fn cell_value(&mut self, sheet: usize, c: CellRef) -> Value;
    fn now_serial(&self) -> f64;
    fn random(&mut self) -> f64;

    // Provided methods
    fn note_volatile(&mut self) { ... }
    fn spill_range(&mut self, sheet: usize, anchor: CellRef) -> Option<RangeRef> { ... }
    fn range_values(&mut self, sheet: usize, range: RangeRef) -> Vec<Value> { ... }
    fn used_range(&mut self, sheet: usize) -> Option<RangeRef> { ... }
    fn visit_range(
        &mut self,
        _sheet: usize,
        _range: RangeRef,
        _f: &mut dyn FnMut(&Value) -> bool,
    ) -> bool { ... }
    fn stack_top(&self) -> Option<usize> { ... }
    fn stack_exhausted(&mut self) { ... }
}
Expand description

What the evaluator needs from its surroundings.

Required Methods§

Source

fn workbook(&self) -> &Workbook

Source

fn cell_value(&mut self, sheet: usize, c: CellRef) -> Value

The current value of a cell (evaluating it first if it is dirty).

Source

fn now_serial(&self) -> f64

Source

fn random(&mut self) -> f64

Provided Methods§

Source

fn note_volatile(&mut self)

Called when a volatile or dynamic-reference function is used.

Source

fn spill_range(&mut self, sheet: usize, anchor: CellRef) -> Option<RangeRef>

The spill range of the dynamic array anchored at anchor (None: it doesn’t spill).

Source

fn range_values(&mut self, sheet: usize, range: RangeRef) -> Vec<Value>

Values of a block, row-major. Hosts can override with a sparse fast path.

Source

fn used_range(&mut self, sheet: usize) -> Option<RangeRef>

The sheet’s used range (Sheet::used_range, which walks every stored row). Hosts that keep the workbook unchanged while evaluating can remember it.

Source

fn visit_range( &mut self, _sheet: usize, _range: RangeRef, _f: &mut dyn FnMut(&Value) -> bool, ) -> bool

Calls f on each stored value of a block, row-major (formula cells evaluated first), until f returns false. false when this host can’t (callers use range_values).

Source

fn stack_top(&self) -> Option<usize>

While a formula is calculated on demand inside another one: stack_position() where the outermost one started, which the stack budget is counted from.

Source

fn stack_exhausted(&mut self)

Called when a formula’s evaluation runs past the stack budget.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§