pub trait IKeyExprTree<'a, Weight> {
type Node: IKeyExprTreeNodeMut<Weight>;
type TreeIterItem;
type TreeIter: Iterator<Item = Self::TreeIterItem>;
type IntersectionItem;
type Intersection: Iterator<Item = Self::IntersectionItem>;
type InclusionItem;
type Inclusion: Iterator<Item = Self::InclusionItem>;
type IncluderItem;
type Includer: Iterator<Item = Self::IncluderItem>;
// Required methods
fn node(&'a self, key: &keyexpr) -> Option<&'a Self::Node>;
fn tree_iter(&'a self) -> Self::TreeIter;
fn intersecting_nodes(&'a self, key: &'a keyexpr) -> Self::Intersection;
fn included_nodes(&'a self, key: &'a keyexpr) -> Self::Inclusion;
fn nodes_including(&'a self, key: &'a keyexpr) -> Self::Includer;
// Provided methods
fn weight_at(&'a self, key: &keyexpr) -> Option<&'a Weight> { ... }
fn key_value_pairs(
&'a self,
) -> FilterMap<Self::TreeIter, fn(Self::TreeIterItem) -> Option<(OwnedKeyExpr, &'a Weight)>> ⓘ
where Self::TreeIterItem: AsNode<Box<Self::Node>> { ... }
fn intersecting_keys(
&'a self,
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,
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,
key: &'a keyexpr,
) -> FilterMap<Self::Includer, fn(Self::IncluderItem) -> Option<OwnedKeyExpr>> ⓘ
where Self::IncluderItem: AsNode<Self::Node>,
Self::Node: IKeyExprTreeNode<Weight> { ... }
}Expand description
The basic immutable methods of all KeTrees.
Required Associated Types§
Sourcetype Node: IKeyExprTreeNodeMut<Weight>
type Node: IKeyExprTreeNodeMut<Weight>
The type of a given node in the KeTree.
The methods of nodes are exposed in the IKeyExprTreeNode and IKeyExprTreeNodeMut traits
type TreeIterItem
type TreeIter: Iterator<Item = Self::TreeIterItem>
type IntersectionItem
type Intersection: Iterator<Item = Self::IntersectionItem>
type InclusionItem
type Inclusion: Iterator<Item = Self::InclusionItem>
type IncluderItem
type Includer: Iterator<Item = Self::IncluderItem>
Required Methods§
Sourcefn node(&'a self, key: &keyexpr) -> Option<&'a Self::Node>
fn node(&'a self, key: &keyexpr) -> Option<&'a 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.
Sourcefn tree_iter(&'a self) -> Self::TreeIter
fn tree_iter(&'a self) -> Self::TreeIter
Iterates over the whole tree, including nodes with no weight.
IKeyExprTree::key_value_pairs provides an iterator over all key-value pairs in the tree.
Sourcefn intersecting_nodes(&'a self, key: &'a keyexpr) -> Self::Intersection
fn intersecting_nodes(&'a self, 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.
Sourcefn included_nodes(&'a self, key: &'a keyexpr) -> Self::Inclusion
fn included_nodes(&'a self, 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.
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.
Sourcefn nodes_including(&'a self, key: &'a keyexpr) -> Self::Includer
fn nodes_including(&'a self, 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.
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.
Provided Methods§
Sourcefn weight_at(&'a self, key: &keyexpr) -> Option<&'a Weight>
fn weight_at(&'a self, key: &keyexpr) -> Option<&'a Weight>
Returns a reference to the weight of the node at key if it exists.
Sourcefn key_value_pairs(
&'a self,
) -> FilterMap<Self::TreeIter, fn(Self::TreeIterItem) -> Option<(OwnedKeyExpr, &'a Weight)>> ⓘ
fn key_value_pairs( &'a self, ) -> FilterMap<Self::TreeIter, fn(Self::TreeIterItem) -> Option<(OwnedKeyExpr, &'a Weight)>> ⓘ
Iterates through weighted nodes, yielding their KE and Weight.
Sourcefn intersecting_keys(
&'a self,
key: &'a keyexpr,
) -> FilterMap<Self::Intersection, fn(Self::IntersectionItem) -> Option<OwnedKeyExpr>> ⓘ
fn intersecting_keys( &'a self, key: &'a keyexpr, ) -> FilterMap<Self::Intersection, fn(Self::IntersectionItem) -> Option<OwnedKeyExpr>> ⓘ
Returns an iterator over the KEs contained in the tree that intersect with key
Sourcefn included_keys(
&'a self,
key: &'a keyexpr,
) -> FilterMap<Self::Inclusion, fn(Self::InclusionItem) -> Option<OwnedKeyExpr>> ⓘ
fn included_keys( &'a self, key: &'a keyexpr, ) -> FilterMap<Self::Inclusion, fn(Self::InclusionItem) -> Option<OwnedKeyExpr>> ⓘ
Returns an iterator over the KEs contained in the tree that are included by key
Sourcefn keys_including(
&'a self,
key: &'a keyexpr,
) -> FilterMap<Self::Includer, fn(Self::IncluderItem) -> Option<OwnedKeyExpr>> ⓘ
fn keys_including( &'a self, key: &'a keyexpr, ) -> FilterMap<Self::Includer, fn(Self::IncluderItem) -> Option<OwnedKeyExpr>> ⓘ
Returns an iterator over the KEs contained in the tree that include key
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".