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§
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§
Sourcefn node_mut<'b>(&'b mut self, key: &keyexpr) -> Option<&'b mut Self::Node>
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.
Sourcefn node_mut_or_create<'b>(&'b mut self, key: &keyexpr) -> &'b mut Self::Node
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.
Sourcefn remove(&mut self, key: &keyexpr) -> Option<Weight>
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.
Sourcefn tree_iter_mut(&'a mut self) -> Self::TreeIterMut
fn tree_iter_mut(&'a mut self) -> Self::TreeIterMut
Iterates over the whole tree, including nodes with no weight.
Sourcefn intersecting_nodes_mut(
&'a mut self,
key: &'a keyexpr,
) -> Self::IntersectionMut
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.
Sourcefn included_nodes_mut(&'a mut self, key: &'a keyexpr) -> Self::InclusionMut
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.
Sourcefn nodes_including_mut(&'a mut self, key: &'a keyexpr) -> Self::IncluderMut
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.
Sourcefn prune_where<F: FnMut(&mut Self::Node) -> bool>(&mut self, predicate: F)
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§
Sourcefn weight_at_mut(&'a mut self, key: &keyexpr) -> Option<&'a mut Weight>
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
.
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.