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§
fn workbook(&self) -> &Workbook
Sourcefn cell_value(&mut self, sheet: usize, c: CellRef) -> Value
fn cell_value(&mut self, sheet: usize, c: CellRef) -> Value
The current value of a cell (evaluating it first if it is dirty).
fn now_serial(&self) -> f64
fn random(&mut self) -> f64
Provided Methods§
Sourcefn note_volatile(&mut self)
fn note_volatile(&mut self)
Called when a volatile or dynamic-reference function is used.
Sourcefn spill_range(&mut self, sheet: usize, anchor: CellRef) -> Option<RangeRef>
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).
Sourcefn range_values(&mut self, sheet: usize, range: RangeRef) -> Vec<Value>
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.
Sourcefn used_range(&mut self, sheet: usize) -> Option<RangeRef>
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.
Sourcefn visit_range(
&mut self,
_sheet: usize,
_range: RangeRef,
_f: &mut dyn FnMut(&Value) -> bool,
) -> bool
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).
Sourcefn stack_top(&self) -> Option<usize>
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.
Sourcefn stack_exhausted(&mut self)
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".