pub struct ReactiveEngineV0 { /* private fields */ }Implementations§
Source§impl ReactiveEngineV0
impl ReactiveEngineV0
pub fn node_count(&self) -> usize
pub fn node_kind( &self, node: ReactiveNodeIdV0, ) -> Result<ReactiveNodeKindV0, ReactiveEngineErrorV0>
pub fn state( &self, node: ReactiveNodeIdV0, ) -> Result<&ReactiveStateV0, ReactiveEngineErrorV0>
pub fn is_necessary( &self, node: ReactiveNodeIdV0, ) -> Result<bool, ReactiveEngineErrorV0>
pub fn is_stale( &self, node: ReactiveNodeIdV0, ) -> Result<bool, ReactiveEngineErrorV0>
pub fn node_recompute_count( &self, node: ReactiveNodeIdV0, ) -> Result<usize, ReactiveEngineErrorV0>
pub fn delta_update_count( &self, node: ReactiveNodeIdV0, ) -> Result<usize, ReactiveEngineErrorV0>
pub fn current_wave(&self) -> u64
pub fn is_stabilizing(&self) -> bool
pub fn has_pending_work(&self) -> bool
Sourcepub fn deposit(
&mut self,
node: ReactiveNodeIdV0,
state: ReactiveStateV0,
) -> Result<(), ReactiveEngineErrorV0>
pub fn deposit( &mut self, node: ReactiveNodeIdV0, state: ReactiveStateV0, ) -> Result<(), ReactiveEngineErrorV0>
Queues the latest value for an input-like node. The deposit is applied only when the next wave begins, including when it arrives between bounded steps of the current wave.
Examples found in repository?
examples/performance_envelope.rs (lines 72-75)
61fn measure(changes_input: bool) -> Result<Vec<Duration>, Box<dyn Error>> {
62 let (mut engine, inputs) = graph()?;
63 let mut samples = Vec::with_capacity(EVENT_COUNT);
64 for event in 0..EVENT_COUNT {
65 let index = event % INPUT_COUNT;
66 let value = if changes_input {
67 (index + event + 1) as u64
68 } else {
69 index as u64
70 };
71 let started = Instant::now();
72 engine.deposit(
73 inputs[index],
74 ReactiveStateV0::available(ReactiveValueV0::Counter(value)),
75 )?;
76 settle(&mut engine)?;
77 engine.drain_effect_receipts();
78 samples.push(started.elapsed());
79 }
80 Ok(samples)
81}Sourcepub fn observe(
&mut self,
node: ReactiveNodeIdV0,
) -> Result<(), ReactiveEngineErrorV0>
pub fn observe( &mut self, node: ReactiveNodeIdV0, ) -> Result<(), ReactiveEngineErrorV0>
Examples found in repository?
examples/performance_envelope.rs (line 55)
36fn graph() -> Result<(ReactiveEngineV0, Vec<ReactiveNodeIdV0>), Box<dyn Error>> {
37 let policy = ChangePolicyV0::exact("performanceSemanticValue");
38 let mut graph = ReactiveGraphBuilderV0::new();
39 let mut inputs = Vec::with_capacity(INPUT_COUNT);
40 let mut projections = Vec::with_capacity(INPUT_COUNT);
41 for index in 0..INPUT_COUNT {
42 let input = graph.add_input(
43 ReactiveStateV0::available(ReactiveValueV0::Counter(index as u64)),
44 policy,
45 );
46 inputs.push(input);
47 projections.push((
48 format!("projection-{index}"),
49 graph.add_map(input, project_counter, policy),
50 ));
51 }
52 let fold = graph.add_delta_fold(projections, policy)?;
53 let boundary = graph.add_effect_boundary(fold, "performance-observation", policy);
54 let mut engine = graph.build()?;
55 engine.observe(boundary)?;
56 settle(&mut engine)?;
57 engine.drain_effect_receipts();
58 Ok((engine, inputs))
59}pub fn unobserve( &mut self, node: ReactiveNodeIdV0, ) -> Result<(), ReactiveEngineErrorV0>
Sourcepub fn stabilize_step(
&mut self,
maximum_recomputes: usize,
) -> Result<StabilizeStatusV0, ReactiveEngineErrorV0>
pub fn stabilize_step( &mut self, maximum_recomputes: usize, ) -> Result<StabilizeStatusV0, ReactiveEngineErrorV0>
pub fn stabilize_until_settled( &mut self, maximum_recomputes: usize, ) -> Result<StabilizeStatusV0, ReactiveEngineErrorV0>
Sourcepub fn drain_effect_receipts(&mut self) -> Vec<EffectReceiptV0>
pub fn drain_effect_receipts(&mut self) -> Vec<EffectReceiptV0>
Examples found in repository?
examples/performance_envelope.rs (line 57)
36fn graph() -> Result<(ReactiveEngineV0, Vec<ReactiveNodeIdV0>), Box<dyn Error>> {
37 let policy = ChangePolicyV0::exact("performanceSemanticValue");
38 let mut graph = ReactiveGraphBuilderV0::new();
39 let mut inputs = Vec::with_capacity(INPUT_COUNT);
40 let mut projections = Vec::with_capacity(INPUT_COUNT);
41 for index in 0..INPUT_COUNT {
42 let input = graph.add_input(
43 ReactiveStateV0::available(ReactiveValueV0::Counter(index as u64)),
44 policy,
45 );
46 inputs.push(input);
47 projections.push((
48 format!("projection-{index}"),
49 graph.add_map(input, project_counter, policy),
50 ));
51 }
52 let fold = graph.add_delta_fold(projections, policy)?;
53 let boundary = graph.add_effect_boundary(fold, "performance-observation", policy);
54 let mut engine = graph.build()?;
55 engine.observe(boundary)?;
56 settle(&mut engine)?;
57 engine.drain_effect_receipts();
58 Ok((engine, inputs))
59}
60
61fn measure(changes_input: bool) -> Result<Vec<Duration>, Box<dyn Error>> {
62 let (mut engine, inputs) = graph()?;
63 let mut samples = Vec::with_capacity(EVENT_COUNT);
64 for event in 0..EVENT_COUNT {
65 let index = event % INPUT_COUNT;
66 let value = if changes_input {
67 (index + event + 1) as u64
68 } else {
69 index as u64
70 };
71 let started = Instant::now();
72 engine.deposit(
73 inputs[index],
74 ReactiveStateV0::available(ReactiveValueV0::Counter(value)),
75 )?;
76 settle(&mut engine)?;
77 engine.drain_effect_receipts();
78 samples.push(started.elapsed());
79 }
80 Ok(samples)
81}pub fn verify_delta_fold( &self, node: ReactiveNodeIdV0, ) -> Result<(), DeltaFoldParityErrorV0>
Auto Trait Implementations§
impl Freeze for ReactiveEngineV0
impl RefUnwindSafe for ReactiveEngineV0
impl Send for ReactiveEngineV0
impl Sync for ReactiveEngineV0
impl Unpin for ReactiveEngineV0
impl UnsafeUnpin for ReactiveEngineV0
impl UnwindSafe for ReactiveEngineV0
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
Mutably borrows from an owned value. Read more