pub struct NodeMut<'a, N> where
N: 'a, { /* fields omitted */ }
Represents a borrowed node in the Eytzinger tree. This node may be used mutate this node's value
and child nodes.
Gets the Eytzinger tree this node is for.
Gets the value stored at this node.
use lz_eytzinger_tree::{EytzingerTree, Node};
let mut tree = {
let mut tree = EytzingerTree::<u32>::new(8);
tree.set_root_value(5);
tree
};
let root = tree.root_mut().unwrap();
assert_eq!(root.value(), &5);
Gets the mutable value stored at this node.
use lz_eytzinger_tree::{EytzingerTree, Node};
let mut tree = {
let mut tree = EytzingerTree::<u32>::new(8);
tree.set_root_value(5);
tree
};
let mut root = tree.root_mut().unwrap();
*root.value_mut() = 8;
assert_eq!(root.value(), &8);
Gets the mutable value stored at this node.
This differs from value_mut
in that it takes ownership of the current node and the value
is lifetime bound to the tree and not to the current node.
Gets the parent of this node or None
is there was none.
Gets the mutable paret of this node or None
if there wasn't one.
This differs from parent_mut
in that it takes ownership of the current node and is
lifetime bound to the tree and not to the current node.
Gets the child of this node at the specified index or None
if there wasn't one.
Gets the mutable child of this node at the specified index or None
if there wasn't one.
Gets the mutable child of this node at the specified index or None
if there wasn't one.
This differs from child_mut
in that it takes ownership of the current node and is
lifetime bound to the tree and not to the current node.
Sets the value of the child at the specified index.
The new mutable child.
Removes the child value at the specified child index. This will also remove all children of
the specified child.
The old child value if there was one.
pub fn child_entry(&mut self, index: usize) -> Entry<N> | [src] |
Gets the child entry of this node at the specified index. This node is not consumed in the
process so the child entry is lifetime bound to this node.
pub fn to_child_entry(self, index: usize) -> Entry<'a, N> | [src] |
Gets the child entry of this node at the specified index.
This differs from child_entry
in that it takes ownership of the current node and the
entry is lifetime bound to the tree and not to the current node.
Removes this node from the tree.
use lz_eytzinger_tree::{EytzingerTree, Node};
let mut tree = {
let mut tree = EytzingerTree::<u32>::new(8);
tree.set_root_value(5);
tree
};
{
let mut root = tree.root_mut().unwrap();
root.remove();
}
assert_eq!(tree.root(), None);
Gets a view of this mutable node as an immutable node. The resulting node is lifetime bound
to this node so the immutable node may not outlive this mutable node.
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 mut 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_mut().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.
Formats the value using the given formatter. Read more
Mutably dereferences the value.
type Target = N
The resulting type after dereferencing.
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