Skip to main content

WavlTreeAugmentedInvariantObserverTraits

Trait WavlTreeAugmentedInvariantObserverTraits 

Source
pub trait WavlTreeAugmentedInvariantObserverTraits {
    type Target;
    type Value: Copy;

    // Required methods
    fn get_node_value(node: &Self::Target) -> Self::Value;
    fn get_subtree_value(node: &Self::Target) -> Self::Value;
    fn combine_values(a: Self::Value, b: Self::Value) -> Self::Value;
    fn set_subtree_value(node: &mut Self::Target, val: Self::Value);
    fn reset_subtree_value(node: &mut Self::Target);
}
Expand description

Traits to implement to use WavlTreeAugmentedInvariantObserver.

Required Associated Types§

Source

type Target

The type of the node.

Source

type Value: Copy

The type of the invariant value.

Required Methods§

Source

fn get_node_value(node: &Self::Target) -> Self::Value

Returns the invariant value for the given node.

Source

fn get_subtree_value(node: &Self::Target) -> Self::Value

Returns the invariant value for the given node’s subtree.

Source

fn combine_values(a: Self::Value, b: Self::Value) -> Self::Value

Combines subtree and node invariant values to produce a new subtree invariant value.

Values are combined in in-order (left-to-right) sequence: left_subtree_value is combined with node_value, and the result is combined with right_subtree_value.

The operation must be associative: (a ∘ b) ∘ c == a ∘ (b ∘ c). Non-commutative operations (such as string concatenation or sequence tracking) are supported because child and node values are strictly combined in in-order sequence across insertions, erasures, and rotations.

Source

fn set_subtree_value(node: &mut Self::Target, val: Self::Value)

Sets the node’s subtree invariant value.

Source

fn reset_subtree_value(node: &mut Self::Target)

Resets the node’s subtree invariant value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§