pub struct Calc<'m> { /* private fields */ }Expand description
One recalculation of one model under one library: the plan made once, the cells evaluated in order, by steps or all at once.
Implementations§
Source§impl<'m> Calc<'m>
impl<'m> Calc<'m>
Sourcepub fn new(model: &'m Workbook, library: &'m Library) -> Calc<'m>
pub fn new(model: &'m Workbook, library: &'m Library) -> Calc<'m>
The plan over the model: every formula cell’s text read off the
grid (a shared formula’s child as its master’s text moved), the
graph built from refers, the order found and every cycle named.
Nothing is evaluated yet.
Sourcepub fn run(model: &'m Workbook, library: &'m Library) -> Calc<'m>
pub fn run(model: &'m Workbook, library: &'m Library) -> Calc<'m>
The plan made and every cell evaluated.
Sourcepub fn cycles(&self) -> &[Vec<(usize, u32, u32)>]
pub fn cycles(&self) -> &[Vec<(usize, u32, u32)>]
Every cycle, each its cells sorted, the cycles by their first cell.
Sourcepub fn formula(&self, id: (usize, u32, u32)) -> Option<&str>
pub fn formula(&self, id: (usize, u32, u32)) -> Option<&str>
A formula cell’s text without its =, or None for a value cell.
Sourcepub fn formula_cells(&self) -> Vec<(usize, u32, u32)>
pub fn formula_cells(&self) -> Vec<(usize, u32, u32)>
Every formula cell, in sheet then row-major order.
Sourcepub fn computed(&self, id: (usize, u32, u32)) -> Option<&Computed>
pub fn computed(&self, id: (usize, u32, u32)) -> Option<&Computed>
What a formula cell holds, once evaluated; None for a value cell
or a cell the steps have not reached.
Sourcepub fn step(&mut self, budget: usize) -> Progress
pub fn step(&mut self, budget: usize) -> Progress
Evaluate the next cells of the order, at most budget of them, 0
meaning every one: SD-34’s step, a budget in cells and never in
time, so that the frame’s values are the same whatever the host’s
chunking. The cells in a cycle count as done from the start.
Sourcepub fn missing_functions(&self) -> Vec<((usize, u32, u32), String)>
pub fn missing_functions(&self) -> Vec<((usize, u32, u32), String)>
The functions the formulas call that the library does not hold,
with the first cell calling each, in sheet then row-major order:
what the engine’s load refuses by name before the first step.
Sourcepub fn spell_cell(&self, id: (usize, u32, u32)) -> String
pub fn spell_cell(&self, id: (usize, u32, u32)) -> String
Sheet!A1 for a cell, the sheet quoted as a reference quotes it.
Sourcepub fn first_refusal(&self) -> Option<Refusal>
pub fn first_refusal(&self) -> Option<Refusal>
The first thing that stops the whole grid from being stepped, as a
refusal from the catalogue: a cycle, naming the cells that close it
(calc-cycle), else the first function the library does not hold,
naming the cell that calls it (calc-function-not-computed), else
the first formula whose text this version does not read, naming the
construct (calc-construct-not-read, KERNEL.22: the “unreadable
reference” KERNEL.7’s fifth decision named for an engine’s load);
None when every formula can be computed. An engine’s load asks
this once; frazaro calc never does, since a workbook is read as it
is and each cell says what it can.
Trait Implementations§
Source§impl Env for Calc<'_>
impl Env for Calc<'_>
Source§fn read(&self, id: (usize, u32, u32)) -> Result<Value, Reason>
fn read(&self, id: (usize, u32, u32)) -> Result<Value, Reason>
Empty for a cell with nothing; a formula not computed is
the reason, which propagates.Source§fn extent(&self, sheet: usize) -> Option<((u32, u32), (u32, u32))>
fn extent(&self, sheet: usize) -> Option<((u32, u32), (u32, u32))>
Source§fn name(&self, name: &str, scope: Option<usize>, home: usize) -> Option<&str>
fn name(&self, name: &str, scope: Option<usize>, home: usize) -> Option<&str>
graph::Names::resolve
resolves it.Source§fn dense(&self, _sheet: usize) -> Option<&Dense>
fn dense(&self, _sheet: usize) -> Option<&Dense>
.last twin; and since KERNEL.31 for each of its frame’s own sheets
its plan reads by a range or a run’s moving cell, while none of their
formulas holds a reason): each slot the value a read of its cell
answers, or Value::Empty for a cell holding none, which a walk skips
as a walk of the cells skips it; so a range of the sheet is walked by
index and never cell by cell. None, a sheet walked through its
cells, unless an environment says otherwise.Source§fn enter(&self, _id: (usize, u32, u32))
fn enter(&self, _id: (usize, u32, u32))
super::vector),
so that Env::here answers it: an engine’s machine keeps it as it
keeps the cell it evaluates alone. Nothing, unless an environment
says otherwise.Source§impl Values for Calc<'_>
impl Values for Calc<'_>
fn computed(&self, id: (usize, u32, u32)) -> Option<&Computed>
Source§fn kept_extent(&self, sheet: usize) -> Option<Option<((u32, u32), (u32, u32))>>
fn kept_extent(&self, sheet: usize) -> Option<Option<((u32, u32), (u32, u32))>>
extent row without walking every cell of the sheet: the
extent itself, Some(None) for a sheet with no cell, or None to
have the view walk the sheet. Calc keeps every sheet’s from its
making, and an engine’s machine from its load and every write and
frame’s end, for the evaluator (Env::extent).Source§fn lags(&self, _sheet: usize) -> bool
fn lags(&self, _sheet: usize) -> bool
Values::content. No sheet,
for any other.