Skip to main content

ChangePolicyV0

Struct ChangePolicyV0 

Source
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

Source

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

pub const fn custom( name: &'static str, equivalent: fn(&ReactiveStateV0, &ReactiveStateV0) -> bool, ) -> Self

Source

pub fn name(self) -> &'static str

Source

pub fn equivalent( self, previous: &ReactiveStateV0, next: &ReactiveStateV0, ) -> bool

Trait Implementations§

Source§

impl Clone for ChangePolicyV0

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Copy for ChangePolicyV0

Source§

impl Debug for ChangePolicyV0

Source§

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

Formats the value using the given formatter. 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> 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
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> 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, <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.