IKeyExprTreeMut

Trait IKeyExprTreeMut 

Source
pub trait IKeyExprTreeMut<'a, Weight>: IKeyExprTree<'a, Weight> {
    type TreeIterItemMut;
    type TreeIterMut: Iterator<Item = Self::TreeIterItemMut>;
    type IntersectionItemMut;
    type IntersectionMut: Iterator<Item = Self::IntersectionItemMut>;
    type InclusionItemMut;
    type InclusionMut: Iterator<Item = Self::InclusionItemMut>;
    type IncluderItemMut;
    type IncluderMut: Iterator<Item = Self::IncluderItemMut>;

    // Required methods
    fn node_mut<'b>(&'b mut self, key: &keyexpr) -> Option<&'b mut Self::Node>;
    fn node_mut_or_create<'b>(&'b mut self, key: &keyexpr) -> &'b mut Self::Node;
    fn remove(&mut self, key: &keyexpr) -> Option<Weight>;
    fn tree_iter_mut(&'a mut self) -> Self::TreeIterMut;
    fn intersecting_nodes_mut(
        &'a mut self,
        key: &'a keyexpr,
    ) -> Self::IntersectionMut;
    fn included_nodes_mut(&'a mut self, key: &'a keyexpr) -> Self::InclusionMut;
    fn nodes_including_mut(&'a mut self, key: &'a keyexpr) -> Self::IncluderMut;
    fn prune_where<F: FnMut(&mut Self::Node) -> bool>(&mut self, predicate: F);

    // Provided methods
    fn weight_at_mut(&'a mut self, key: &keyexpr) -> Option<&'a mut Weight> { ... }
    fn insert(&mut self, key: &keyexpr, weight: Weight) -> Option<Weight> { ... }
    fn prune(&mut self) { ... }
}
Expand description

The basic mutable methods of all KeTrees.

Required Associated Types§

Required Methods§

Source

fn node_mut<'b>(&'b mut self, key: &keyexpr) -> Option<&'b mut Self::Node>

Mutably accesses the node at key if it exists, treating KEs as if they were completely verbatim keys.

Returns None if key is not present. Use IKeyExprTreeMut::node_mut_or_create if you wish to construct the node if it doesn’t exist.

Source

fn node_mut_or_create<'b>(&'b mut self, key: &keyexpr) -> &'b mut Self::Node

Mutably accesses the node at key, creating it if necessary.

Source

fn remove(&mut self, key: &keyexpr) -> Option<Weight>

Clears the weight of the node at key, but doesn’t actually destroy the node.

To actually destroy nodes, IKeyExprTreeMut::prune_where or IKeyExprTreeMut::prune must be called.

Source

fn tree_iter_mut(&'a mut self) -> Self::TreeIterMut

Iterates over the whole tree, including nodes with no weight.

Source

fn intersecting_nodes_mut( &'a mut self, key: &'a keyexpr, ) -> Self::IntersectionMut

Iterates over all nodes of the tree whose KE intersects with the given key.

Note that nodes without a Weight will also be yielded by the iterator.

Source

fn included_nodes_mut(&'a mut self, key: &'a keyexpr) -> Self::InclusionMut

Iterates over all nodes of the tree whose KE is included by the given key.

Note that nodes without a Weight will also be yielded by the iterator.

Source

fn nodes_including_mut(&'a mut self, key: &'a keyexpr) -> Self::IncluderMut

Iterates over all nodes of the tree whose KE includes the given key.

Note that nodes without a Weight will also be yielded by the iterator.

Source

fn prune_where<F: FnMut(&mut Self::Node) -> bool>(&mut self, predicate: F)

Prunes node from the tree where the predicate returns true.

Note that nodes that still have children will not be pruned.

Provided Methods§

Source

fn weight_at_mut(&'a mut self, key: &keyexpr) -> Option<&'a mut Weight>

Returns a mutable reference to the weight of the node at key.

Source

fn insert(&mut self, key: &keyexpr, weight: Weight) -> Option<Weight>

Inserts a weight at key, returning the previous weight if it existed.

Source

fn prune(&mut self)

Prunes empty nodes from the tree, unless they have at least one non-empty descendent.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, Weight, Children, Wildness: IWildness> IKeyExprTreeMut<'a, Weight> for KeBoxTree<Weight, Wildness, Children>
where Weight: 'a, Children: 'a + IChildrenProvider<Box<KeyExprTreeNode<Weight, Wildness, Children>>>, Children::Assoc: IChildren<Box<KeyExprTreeNode<Weight, Wildness, Children>>, Node = Box<KeyExprTreeNode<Weight, Wildness, Children>>> + 'a,

Source§

type TreeIterItemMut = <<KeBoxTree<Weight, Wildness, Children> as IKeyExprTreeMut<'a, Weight>>::TreeIterMut as Iterator>::Item

Source§

type TreeIterMut = TreeIterMut<'a, Children, Box<KeyExprTreeNode<Weight, Wildness, Children>>, Weight>

Source§

type IntersectionItemMut = <<KeBoxTree<Weight, Wildness, Children> as IKeyExprTreeMut<'a, Weight>>::IntersectionMut as Iterator>::Item

Source§

type IntersectionMut = IterOrOption<IntersectionMut<'a, Children, Box<KeyExprTreeNode<Weight, Wildness, Children>>, Weight>, &'a mut <KeBoxTree<Weight, Wildness, Children> as IKeyExprTree<'a, Weight>>::Node>

Source§

type InclusionItemMut = <<KeBoxTree<Weight, Wildness, Children> as IKeyExprTreeMut<'a, Weight>>::InclusionMut as Iterator>::Item

Source§

type InclusionMut = IterOrOption<InclusionMut<'a, Children, Box<KeyExprTreeNode<Weight, Wildness, Children>>, Weight>, &'a mut <KeBoxTree<Weight, Wildness, Children> as IKeyExprTree<'a, Weight>>::Node>

Source§

type IncluderItemMut = <<KeBoxTree<Weight, Wildness, Children> as IKeyExprTreeMut<'a, Weight>>::IncluderMut as Iterator>::Item

Source§

type IncluderMut = IterOrOption<IncluderMut<'a, Children, Box<KeyExprTreeNode<Weight, Wildness, Children>>, Weight>, &'a mut <KeBoxTree<Weight, Wildness, Children> as IKeyExprTree<'a, Weight>>::Node>