Files
improvise/crates/improvise-incremental/src/lib.rs
T

53 lines
1.9 KiB
Rust

//! The plug: what the evaluator reads, and the oracle that answers it today.
//! Reasoning: `context/code/improvise-incremental.md`.
mod delta;
mod eager;
mod edit;
mod fold;
mod formulas;
mod group;
mod harness;
mod incremental;
mod pushdown;
mod reading;
mod reads;
mod shapes;
pub use delta::{CellDelta, DeltaValue, cell_delta, moved_records};
pub use eager::Eager;
pub use edit::Edit;
pub use harness::{
Divergence, MAX_DROPPED, Maintained, Probe, Report, differential, differential_in,
drawn_probes, edit_probes, probes, same_value,
};
pub use incremental::{Evaluation, Incremental};
pub use pushdown::Pushdown;
pub use reading::Reading;
pub use shapes::Meter;
use improvise_core::model::Aggregation;
use improvise_core::model::cell::{CellKey, CellValue};
/// What the evaluator reads (ADR 009 clause 2) and what a view draws from it.
pub trait Derived {
/// The value at `key`: the formula result when a formula owns it, else the
/// cell as stored or folded over what `agg` hides. `Model::evaluate_aggregated`.
fn value(&self, key: &CellKey, agg: Aggregation) -> Option<CellValue>;
/// The raw fold of the stored cells that match `partial`, by the measure's
/// aggregation. Never a formula: `None` for a partial naming a formula target.
fn raw_fold(&self, partial: &CellKey) -> Option<CellValue>;
/// `key` as a view reads it: a collapsed group folds only the members
/// `reading` leaves visible. `Model::evaluate_covering`.
fn covered(&self, key: &CellKey, reading: &Reading) -> Option<CellValue>;
/// A column's total: `key` as ONE fold over every visible item of the
/// `over` categories it omits. `Model::evaluate_spanning`.
fn total(&self, key: &CellKey, over: &[String], reading: &Reading) -> Option<CellValue>;
/// How many stored cells match `partial` with no hidden coordinate.
fn occupancy(&self, partial: &CellKey, reading: &Reading) -> usize;
}