pub struct ReactiveGraphBuilderV0 { /* private fields */ }Implementations§
Source§impl ReactiveGraphBuilderV0
impl ReactiveGraphBuilderV0
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/performance_envelope.rs (line 38)
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}Sourcepub fn add_input(
&mut self,
initial_state: ReactiveStateV0,
change_policy: ChangePolicyV0,
) -> ReactiveNodeIdV0
pub fn add_input( &mut self, initial_state: ReactiveStateV0, change_policy: ChangePolicyV0, ) -> ReactiveNodeIdV0
Examples found in repository?
examples/performance_envelope.rs (lines 42-45)
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 add_async_result( &mut self, initial_state: ReactiveStateV0, change_policy: ChangePolicyV0, ) -> ReactiveNodeIdV0
Sourcepub fn add_map(
&mut self,
dependency: ReactiveNodeIdV0,
operation: MapOperationV0,
change_policy: ChangePolicyV0,
) -> ReactiveNodeIdV0
pub fn add_map( &mut self, dependency: ReactiveNodeIdV0, operation: MapOperationV0, change_policy: ChangePolicyV0, ) -> ReactiveNodeIdV0
Examples found in repository?
examples/performance_envelope.rs (line 49)
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 add_zip( &mut self, left: ReactiveNodeIdV0, right: ReactiveNodeIdV0, operation: ZipOperationV0, change_policy: ChangePolicyV0, ) -> ReactiveNodeIdV0
Sourcepub fn add_switch(
&mut self,
selector: ReactiveNodeIdV0,
when_false: ReactiveNodeIdV0,
when_true: ReactiveNodeIdV0,
change_policy: ChangePolicyV0,
) -> ReactiveNodeIdV0
pub fn add_switch( &mut self, selector: ReactiveNodeIdV0, when_false: ReactiveNodeIdV0, when_true: ReactiveNodeIdV0, change_policy: ChangePolicyV0, ) -> ReactiveNodeIdV0
Adds a static two-branch switch. Branch identities cannot be changed after the graph is built.
Sourcepub fn add_delta_fold(
&mut self,
entries: Vec<(String, ReactiveNodeIdV0)>,
change_policy: ChangePolicyV0,
) -> Result<ReactiveNodeIdV0, ReactiveGraphBuildErrorV0>
pub fn add_delta_fold( &mut self, entries: Vec<(String, ReactiveNodeIdV0)>, change_policy: ChangePolicyV0, ) -> Result<ReactiveNodeIdV0, ReactiveGraphBuildErrorV0>
Examples found in repository?
examples/performance_envelope.rs (line 52)
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}Sourcepub fn add_effect_boundary(
&mut self,
dependency: ReactiveNodeIdV0,
channel: impl Into<String>,
change_policy: ChangePolicyV0,
) -> ReactiveNodeIdV0
pub fn add_effect_boundary( &mut self, dependency: ReactiveNodeIdV0, channel: impl Into<String>, change_policy: ChangePolicyV0, ) -> ReactiveNodeIdV0
Examples found in repository?
examples/performance_envelope.rs (line 53)
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}Sourcepub fn build(self) -> Result<ReactiveEngineV0, ReactiveGraphBuildErrorV0>
pub fn build(self) -> Result<ReactiveEngineV0, ReactiveGraphBuildErrorV0>
Examples found in repository?
examples/performance_envelope.rs (line 54)
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}Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReactiveGraphBuilderV0
impl RefUnwindSafe for ReactiveGraphBuilderV0
impl Send for ReactiveGraphBuilderV0
impl Sync for ReactiveGraphBuilderV0
impl Unpin for ReactiveGraphBuilderV0
impl UnsafeUnpin for ReactiveGraphBuilderV0
impl UnwindSafe for ReactiveGraphBuilderV0
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