pub trait IKeyExprTreeNode<Weight>: UIKeyExprTreeNode<Weight> {
// Provided methods
fn parent(&self) -> Option<&Self::Parent> { ... }
fn keyexpr(&self) -> OwnedKeyExpr { ... }
fn weight(&self) -> Option<&Weight> { ... }
fn children(&self) -> &Self::Children { ... }
}
Expand description
The non-mutating methods of a KeTree node.
Provided Methods§
Sourcefn parent(&self) -> Option<&Self::Parent>
fn parent(&self) -> Option<&Self::Parent>
Access the parent node if it exists (the node isn’t the first chunk of a key-expression).
Sourcefn keyexpr(&self) -> OwnedKeyExpr
fn keyexpr(&self) -> OwnedKeyExpr
Compute this node’s full key expression.
Note that KeTrees don’t normally store each node’s full key expression.
If you need to repeatedly access a node’s full key expression, it is suggested
to store that key expression as part of the node’s Weight
(it’s optional value).
Sourcefn weight(&self) -> Option<&Weight>
fn weight(&self) -> Option<&Weight>
Access the node’s weight (or value).
Weights can be assigned to a node through many of IKeyExprTreeNodeMut
’s methods, as well as through IKeyExprTreeMut::insert
.
Nodes may not have a value in any of the following cases:
- The node is a parent to other nodes, but was never assigned a weight itself (or that weight has been removed).
- The node is a leaf of the KeTree whose value was
IKeyExprTreeMut::remove
d, butIKeyExprTreeMut::prune
hasn’t been called yet.