pub struct ChangePolicyV0 { /* private fields */ }Expand description
A named semantic equivalence relation used to decide whether a new node value should propagate.
There is intentionally no Default implementation. A graph constructor
cannot create a node without selecting a policy.
Implementations§
Source§impl ChangePolicyV0
impl ChangePolicyV0
Sourcepub const fn exact(name: &'static str) -> Self
pub const fn exact(name: &'static str) -> Self
Examples found in repository?
examples/performance_envelope.rs (line 37)
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 const fn custom( name: &'static str, equivalent: fn(&ReactiveStateV0, &ReactiveStateV0) -> bool, ) -> Self
pub fn name(self) -> &'static str
pub fn equivalent( self, previous: &ReactiveStateV0, next: &ReactiveStateV0, ) -> bool
Trait Implementations§
Source§impl Clone for ChangePolicyV0
impl Clone for ChangePolicyV0
Source§fn clone(&self) -> ChangePolicyV0
fn clone(&self) -> ChangePolicyV0
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ChangePolicyV0
Auto Trait Implementations§
impl Freeze for ChangePolicyV0
impl RefUnwindSafe for ChangePolicyV0
impl Send for ChangePolicyV0
impl Sync for ChangePolicyV0
impl Unpin for ChangePolicyV0
impl UnsafeUnpin for ChangePolicyV0
impl UnwindSafe for ChangePolicyV0
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