zenoh_keyexpr::keyexpr_tree::traits

Trait ITokenKeyExprTree

source
pub trait ITokenKeyExprTree<'a, Weight, Token> {
Show 37 associated items type Node: IKeyExprTreeNode<Weight>; type NodeMut: IKeyExprTreeNodeMut<Weight>; type TreeIterItem; type TreeIter: Iterator<Item = Self::TreeIterItem>; type TreeIterItemMut; type TreeIterMut: Iterator<Item = Self::TreeIterItemMut>; type IntersectionItem; type Intersection: Iterator<Item = Self::IntersectionItem>; type IntersectionItemMut; type IntersectionMut: Iterator<Item = Self::IntersectionItemMut>; type InclusionItem; type Inclusion: Iterator<Item = Self::InclusionItem>; type InclusionItemMut; type InclusionMut: Iterator<Item = Self::InclusionItemMut>; type IncluderItem; type Includer: Iterator<Item = Self::IncluderItem>; type IncluderItemMut; type IncluderMut: Iterator<Item = Self::IncluderItemMut>; type PruneNode: IKeyExprTreeNodeMut<Weight>; // Required methods fn node(&'a self, token: &'a Token, key: &keyexpr) -> Option<Self::Node>; fn node_mut( &'a self, token: &'a mut Token, key: &keyexpr, ) -> Option<Self::NodeMut>; fn node_or_create( &'a self, token: &'a mut Token, key: &keyexpr, ) -> Self::NodeMut; fn tree_iter(&'a self, token: &'a Token) -> Self::TreeIter; fn tree_iter_mut(&'a self, token: &'a mut Token) -> Self::TreeIterMut; fn intersecting_nodes( &'a self, token: &'a Token, key: &'a keyexpr, ) -> Self::Intersection; fn intersecting_nodes_mut( &'a self, token: &'a mut Token, key: &'a keyexpr, ) -> Self::IntersectionMut; fn included_nodes( &'a self, token: &'a Token, key: &'a keyexpr, ) -> Self::Inclusion; fn included_nodes_mut( &'a self, token: &'a mut Token, key: &'a keyexpr, ) -> Self::InclusionMut; fn nodes_including( &'a self, token: &'a Token, key: &'a keyexpr, ) -> Self::Includer; fn nodes_including_mut( &'a self, token: &'a mut Token, key: &'a keyexpr, ) -> Self::IncluderMut; fn prune_where<F: FnMut(&mut Self::PruneNode) -> bool>( &self, token: &mut Token, predicate: F, ); // Provided methods fn insert( &'a self, token: &'a mut Token, at: &keyexpr, weight: Weight, ) -> Option<Weight> { ... } fn remove( &'a mut self, token: &'a mut Token, key: &keyexpr, ) -> Option<Weight> { ... } fn intersecting_keys( &'a self, token: &'a Token, key: &'a keyexpr, ) -> FilterMap<Self::Intersection, fn(_: Self::IntersectionItem) -> Option<OwnedKeyExpr>> where Self::IntersectionItem: AsNode<Self::Node>, Self::Node: IKeyExprTreeNode<Weight> { ... } fn included_keys( &'a self, token: &'a Token, key: &'a keyexpr, ) -> FilterMap<Self::Inclusion, fn(_: Self::InclusionItem) -> Option<OwnedKeyExpr>> where Self::InclusionItem: AsNode<Self::Node>, Self::Node: IKeyExprTreeNode<Weight> { ... } fn keys_including( &'a self, token: &'a Token, key: &'a keyexpr, ) -> FilterMap<Self::Includer, fn(_: Self::IncluderItem) -> Option<OwnedKeyExpr>> where Self::IncluderItem: AsNode<Self::Node>, Self::Node: IKeyExprTreeNode<Weight> { ... } fn prune(&self, token: &mut Token) { ... }
}
Expand description

The basic operations of a KeTree when a Token is necessary to access data.

Required Associated Types§

Required Methods§

source

fn node(&'a self, token: &'a Token, key: &keyexpr) -> Option<Self::Node>

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

Returns None if key is not present in the KeTree.

source

fn node_mut( &'a self, token: &'a mut Token, key: &keyexpr, ) -> Option<Self::NodeMut>

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_or_create( &'a self, token: &'a mut Token, key: &keyexpr, ) -> Self::NodeMut

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

source

fn tree_iter(&'a self, token: &'a Token) -> Self::TreeIter

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

source

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

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

source

fn intersecting_nodes( &'a self, token: &'a Token, key: &'a keyexpr, ) -> Self::Intersection

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.

You can obtain an iterator over key-value pairs using iter.filter_map(|node| node.weight.map(|w| (node.keyexpr(), w))), keep in mind that the full keyexpr of nodes is not stored in them by default, but computed using the tree: if you need to get a node’s key often, inserting its keyexpr in the Weight could be a good idea.

source

fn intersecting_nodes_mut( &'a self, token: &'a mut Token, 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( &'a self, token: &'a Token, key: &'a keyexpr, ) -> Self::Inclusion

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 included_nodes_mut( &'a self, token: &'a mut Token, 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( &'a self, token: &'a Token, key: &'a keyexpr, ) -> Self::Includer

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 nodes_including_mut( &'a self, token: &'a mut Token, 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::PruneNode) -> bool>( &self, token: &mut Token, predicate: F, )

Provided Methods§

source

fn insert( &'a self, token: &'a mut Token, at: &keyexpr, weight: Weight, ) -> Option<Weight>

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

source

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

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

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

source

fn intersecting_keys( &'a self, token: &'a Token, key: &'a keyexpr, ) -> FilterMap<Self::Intersection, fn(_: Self::IntersectionItem) -> Option<OwnedKeyExpr>>
where Self::IntersectionItem: AsNode<Self::Node>, Self::Node: IKeyExprTreeNode<Weight>,

Returns an iterator over the KEs contained in the tree that intersect with key

source

fn included_keys( &'a self, token: &'a Token, key: &'a keyexpr, ) -> FilterMap<Self::Inclusion, fn(_: Self::InclusionItem) -> Option<OwnedKeyExpr>>
where Self::InclusionItem: AsNode<Self::Node>, Self::Node: IKeyExprTreeNode<Weight>,

Returns an iterator over the KEs contained in the tree that are included by key

source

fn keys_including( &'a self, token: &'a Token, key: &'a keyexpr, ) -> FilterMap<Self::Includer, fn(_: Self::IncluderItem) -> Option<OwnedKeyExpr>>
where Self::IncluderItem: AsNode<Self::Node>, Self::Node: IKeyExprTreeNode<Weight>,

Returns an iterator over the KEs contained in the tree that include key

source

fn prune(&self, token: &mut Token)

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, Weight: 'a, Wildness: IWildness + 'a, Children: IChildrenProvider<Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>> + 'a, Token: TokenTrait + 'a> ITokenKeyExprTree<'a, Weight, Token> for KeArcTree<Weight, Token, Wildness, Children>
where Children::Assoc: IChildren<Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>>,

source§

type Node = (&'a Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, &'a Token)

source§

type NodeMut = (&'a Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, &'a mut Token)

source§

type TreeIterItem = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::Node

source§

type TreeIter = TokenPacker<TreeIter<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a Token>

source§

type TreeIterItemMut = Tokenized<&'a Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, &'a mut Token>

source§

type TreeIterMut = TokenPacker<TreeIter<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a mut Token>

source§

type IntersectionItem = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::Node

source§

type Intersection = IterOrOption<TokenPacker<Intersection<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a Token>, <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::IntersectionItem>

source§

type IntersectionItemMut = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::TreeIterItemMut

source§

type IntersectionMut = IterOrOption<TokenPacker<Intersection<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a mut Token>, <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::IntersectionItemMut>

source§

type InclusionItem = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::Node

source§

type Inclusion = IterOrOption<TokenPacker<Inclusion<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a Token>, <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::InclusionItem>

source§

type InclusionItemMut = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::TreeIterItemMut

source§

type InclusionMut = IterOrOption<TokenPacker<Inclusion<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a mut Token>, <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::InclusionItemMut>

source§

type IncluderItem = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::Node

source§

type Includer = IterOrOption<TokenPacker<Includer<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a Token>, <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::IncluderItem>

source§

type IncluderItemMut = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::TreeIterItemMut

source§

type IncluderMut = IterOrOption<TokenPacker<Includer<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a mut Token>, <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::IncluderItemMut>

source§

type PruneNode = KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>