Skip to main content

ReactiveCellGraph

Struct ReactiveCellGraph 

Source
pub struct ReactiveCellGraph {
    pub cells: Vec<ReactiveCell>,
    pub name_to_index: FlatNameIndex,
    pub topo_order: Vec<usize>,
    pub dirty_words: Vec<u64>,
    pub clock_seconds: f64,
}
Expand description

Compiled reactive cell dependency graph.

Fields§

§cells: Vec<ReactiveCell>

List of cell nodes.

§name_to_index: FlatNameIndex

Sorted flat lookup table from cell name to its index in cells.

§topo_order: Vec<usize>

Topologically sorted order of cell indices (dependencies before dependents).

§dirty_words: Vec<u64>

Dirty bitset words (64 cells per word; grows past 64 cells).

§clock_seconds: f64

Current logical time clock (in seconds since epoch / start).

Implementations§

Source§

impl ReactiveCellGraph

Source

pub const CELL_BATCH_512: usize = 512

Homogeneous ready-cluster size for P16.2. Scalar path still evaluates one cell at a time; the batch is the set of dirty cells whose dependencies are already clean, capped at 512.

Source

pub fn new() -> Self

Construct a new empty reactive cell graph.

Source

pub fn from_program(program: &Program) -> Result<Self, ReactiveCellError>

Build a reactive cell graph from an AST Program.

Source

pub fn add_cell(&mut self, decl: CellDecl) -> usize

Add a cell declaration to the graph.

Source

pub fn is_dirty_bit(&self, idx: usize) -> bool

True if cell idx is marked dirty. Works past 64 cells.

Source

pub fn dirty_mask(&self) -> u64

First 64 dirty bits (debug / HUD). Prefer Self::is_dirty_bit.

Source

pub fn compile(&mut self) -> Result<(), ReactiveCellError>

Compile dependencies, wire dependents, check cycles, and compute topological order.

Source

pub fn mark_dirty(&mut self, name: &str)

Mark a single cell and all its transitive downstream dependents as dirty.

Source

pub fn mark_all_dirty(&mut self)

Mark all cells in the graph as dirty.

Source

pub fn set_input(&mut self, name: &str, value: Value, env: &mut Env)

Set an external input signal / variable and mark downstream cells dirty.

Source

pub fn step( &mut self, env: &mut Env, dt_seconds: f64, ) -> Result<Vec<(String, Value)>, ReactiveCellError>

Advance time and evaluate dirty cells on a local in-process host.

Prefer Self::step_with when a live Host (Poet, tests with query rows, GPU) must dispatch capability.invoke.

Source

pub fn evaluate_cell_batch_512<H: Host>( &mut self, engine: &mut Engine<'_, H>, env: &mut Env, dt_seconds: f64, ) -> Result<Vec<(String, Value)>, ReactiveCellError>

One ready cluster of up to 512 dirty cells, then stop. Callers loop until the dirty set is empty.

Source

pub fn step_with<H: Host>( &mut self, engine: &mut Engine<'_, H>, env: &mut Env, dt_seconds: f64, ) -> Result<Vec<(String, Value)>, ReactiveCellError>

Advance time and evaluate dirty cells through the caller’s engine/host.

Source

pub fn get_value(&self, name: &str) -> Option<&Value>

Retrieve the current cached value of a cell by name.

Trait Implementations§

Source§

impl Clone for ReactiveCellGraph

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReactiveCellGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ReactiveCellGraph

Source§

fn default() -> Self

Returns the “default value” for a type. 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,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

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,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,