pub struct Engine { /* private fields */ }Expand description
A live, incremental evaluation handle over a fixed model structure.
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn new(
model: &Model,
targets: &[MeasureId],
) -> Result<(Engine, Snapshot), EngineError>
pub fn new( model: &Model, targets: &[MeasureId], ) -> Result<(Engine, Snapshot), EngineError>
Build a live engine for model, tracking targets (derived measures).
Seeds the graph with the model’s current input cells and returns a handle
plus the initial snapshot.
Sourcepub fn set(
&mut self,
measure: MeasureId,
coord: CoordKey,
value: f64,
) -> Result<Snapshot, EngineError>
pub fn set( &mut self, measure: MeasureId, coord: CoordKey, value: f64, ) -> Result<Snapshot, EngineError>
Set an input cell to value and return the recomputed snapshot of all
tracked derived measures. Incremental: only affected coordinates flow.
Sourcepub fn clear(
&mut self,
measure: MeasureId,
coord: CoordKey,
) -> Result<Snapshot, EngineError>
pub fn clear( &mut self, measure: MeasureId, coord: CoordKey, ) -> Result<Snapshot, EngineError>
Remove an input cell and return the recomputed snapshot.
Sourcepub fn apply(&mut self, edits: Vec<Edit>) -> Result<Snapshot, EngineError>
pub fn apply(&mut self, edits: Vec<Edit>) -> Result<Snapshot, EngineError>
Apply a batch of edits atomically (one time step) and return the new
snapshot of all tracked derived measures. An edit’s coordinate may list
its categories in any order: it is sorted into the engine’s key form,
which the key kernels (improv_verified::keys) require.
Sourcepub fn serves(&self, model: &Model) -> Result<bool, EngineError>
pub fn serves(&self, model: &Model) -> Result<bool, EngineError>
Whether this engine computes model as a new engine would, so a
model that differs from the one it was built on only in input cells
and in new items can be fed to it as edits. False when a plan reads
the item list of a category that gained items: POSITION, @ITEM,
@ITEMCOUNT, PREV/NEXT, recurrences, windows, per-item and
INTO reductions, FILL (its grid), RELABEL/SWAP (their item
maps), and every
reduction other than SUM … XOR, COUNT, COUNTA and
COUNTUNIQUE (which read only their rows’ values: a new item
reaches them as data, sorted last as an unknown item sorts). New
items must have ids above every item of their category and come
after them in its item order (append-only minting does both).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Engine
impl !UnwindSafe for Engine
impl Freeze for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign, for types that do not implement AddAssign.