ITokenKeyExprTree

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)

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: '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>