Skip to main content

ReactiveGraphBuilderV0

Struct ReactiveGraphBuilderV0 

Source
pub struct ReactiveGraphBuilderV0 { /* private fields */ }

Implementations§

Source§

impl ReactiveGraphBuilderV0

Source

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}
Source

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}
Source

pub fn add_async_result( &mut self, initial_state: ReactiveStateV0, change_policy: ChangePolicyV0, ) -> ReactiveNodeIdV0

Source

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}
Source

pub fn add_zip( &mut self, left: ReactiveNodeIdV0, right: ReactiveNodeIdV0, operation: ZipOperationV0, change_policy: ChangePolicyV0, ) -> ReactiveNodeIdV0

Source

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.

Source

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}
Source

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}
Source

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§

Source§

impl Default for ReactiveGraphBuilderV0

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

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