pub struct Node<'a, N> where
N: 'a, { /* fields omitted */ }
Represents a borrowed node in the Eytzinger tree. This node may be used to navigate to parent or
child nodes.
Gets the Eytzinger tree this node is for.
use lz_eytzinger_tree::{EytzingerTree, Node};
let tree = {
let mut tree = EytzingerTree::<u32>::new(8);
tree.set_root_value(5);
tree
};
let root = tree.root().unwrap();
assert_eq!(root.tree(), &tree);
Gets the value stored at this node.
use lz_eytzinger_tree::{EytzingerTree, Node};
let tree = {
let mut tree = EytzingerTree::<u32>::new(8);
tree.set_root_value(5);
tree
};
let root = tree.root().unwrap();
assert_eq!(root.value(), &5);
Gets the parent of this node or None
is there was none.
use lz_eytzinger_tree::{EytzingerTree, Node};
let tree = {
let mut tree = EytzingerTree::<u32>::new(8);
{
let mut root = tree.set_root_value(5);
root.set_child_value(2, 3);
}
tree
};
let root = tree.root().unwrap();
let child = root.child(2).unwrap();
assert_eq!(child.parent(), Some(root));
Gets the child of this node at the specified index or None
if there wasn't one.
use lz_eytzinger_tree::{EytzingerTree, Node};
let tree = {
let mut tree = EytzingerTree::<u32>::new(8);
{
let mut root = tree.set_root_value(5);
root.set_child_value(2, 3);
}
tree
};
let root = tree.root().unwrap();
let child = root.child(2).unwrap();
assert_eq!(child.value(), &3);
Gets an iterator over the immediate children of this node. This only includes children
for which there is a node.
use lz_eytzinger_tree::{EytzingerTree, Node};
let tree = {
let mut tree = EytzingerTree::<u32>::new(8);
{
let mut root = tree.set_root_value(5);
root.set_child_value(0, 1);
root.set_child_value(2, 3);
}
tree
};
let root = tree.root().unwrap();
let child_values: Vec<_> = root.child_iter().map(|n| n.value()).collect();
assert_eq!(child_values, vec![&1, &3]);
Gets a depth-first iterator over this and all child nodes.
Gets a breadth-first iterator over this and all child nodes.
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
type Target = N
The resulting type after dereferencing.
Feeds this value into the given [Hasher
]. Read more
Feeds a slice of this type into the given [Hasher
]. Read more
type Owned = T
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
type Error = !
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static