Skip to main content

Engine

Struct Engine 

Source
pub struct Engine { /* private fields */ }
Expand description

A live, incremental evaluation handle over a fixed model structure.

Implementations§

Source§

impl Engine

Source

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.

Source

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.

Source

pub fn clear( &mut self, measure: MeasureId, coord: CoordKey, ) -> Result<Snapshot, EngineError>

Remove an input cell and return the recomputed snapshot.

Source

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.

Source

pub fn targets(&self) -> &[MeasureId]

The derived measures this engine tracks.

Source

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§

Source§

impl Drop for Engine

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<'a, S, T> Semigroup<&'a S> for T
where T: Semigroup<S>,

§

fn plus_equals(&mut self, rhs: &&'a S)

The method of std::ops::AddAssign, for types that do not implement AddAssign.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.