Struct tree_cursor::cursor::TreeCursorMut
[−]
[src]
pub struct TreeCursorMut<'n, N: 'n> { /* fields omitted */ }
A cursor that holds a mutable reference to its tree.
Methods
impl<'n, N: 'n> TreeCursorMut<'n, N>
[src]
pub fn new(root: &'n mut N) -> Self
[src]
Creates a new TreeCursorMut
starting at root
.
pub fn down_map<F>(&mut self, f: F) -> bool where
F: Fn(&'n mut N, usize) -> Option<&'n mut N>,
[src]
F: Fn(&'n mut N, usize) -> Option<&'n mut N>,
Passes f
the active node and the current value of the "next child"
counter. If f
returns a node, it's set as the active node, the old
active node's "next child" counter is incremented, and this method
returns true. Otherwise, this method returns false.
pub fn down_map_new<F>(&mut self, f: F) -> Option<Self> where
F: Fn(&'n mut N, usize) -> Option<&'n mut N>,
[src]
F: Fn(&'n mut N, usize) -> Option<&'n mut N>,
pub fn zero(&mut self)
[src]
Resets the active node's "next child" counter to 0.
pub fn up(&mut self) -> bool
[src]
Moves the cursor up one node. Returns true if there was a node to move
to, and false otherwise. In both cases, the old active node's "next
child" counter is reset, as if zero
had been called.
pub fn get(&self) -> &N
[src]
Returns a shared reference to the active node.
pub fn get_mut(&mut self) -> &mut N
[src]
Returns a mutable reference to the active node.
impl<'n, N: 'n + DownMut> TreeCursorMut<'n, N>
[src]
pub fn down(&mut self) -> bool
[src]
Moves the cursor down one node. The node to move to is determined by
calling [DownMut::down_mut
] on the active node and passing it the
"next child" counter. Returns true and increments the old active node's
"next child" counter if there was a node to move to, and returns false
otherwise.
pub fn down_new(&mut self) -> Option<Self>
[src]
Like down
, except instead of moving the position of self
, it
returns a new TreeCursorMut
whose root is the new position. self
is
frozen until the new cursor goes out of scope.
Trait Implementations
impl<'n, N: Debug + 'n> Debug for TreeCursorMut<'n, N>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<'n, N: Eq + 'n> Eq for TreeCursorMut<'n, N>
[src]
impl<'n, N: Hash + 'n> Hash for TreeCursorMut<'n, N>
[src]
fn hash<__HN: Hasher>(&self, __arg_0: &mut __HN)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<'n, N: PartialEq + 'n> PartialEq for TreeCursorMut<'n, N>
[src]
fn eq(&self, __arg_0: &TreeCursorMut<'n, N>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &TreeCursorMut<'n, N>) -> bool
[src]
This method tests for !=
.