zenoh_keyexpr::keyexpr_tree::traits

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.

Object Safety§

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>