pub struct TreeCursor<'n: 'f, 'f, N: 'n> { /* private fields */ }
Expand description
A cursor that holds a shared reference to its tree.
Implementations§
Source§impl<'n, N: 'n> TreeCursor<'n, 'n, N>
impl<'n, N: 'n> TreeCursor<'n, 'n, N>
Source§impl<'n: 'f, 'f, N: 'n> TreeCursor<'n, 'f, N>
impl<'n: 'f, 'f, N: 'n> TreeCursor<'n, 'f, N>
Sourcepub fn down_map<F>(&mut self, f: F) -> bool
pub fn down_map<F>(&mut self, f: F) -> bool
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.
Sourcepub fn down_map_new<'s, F>(&'s mut self, f: F) -> Option<TreeCursor<'n, 's, N>>
pub fn down_map_new<'s, F>(&'s mut self, f: F) -> Option<TreeCursor<'n, 's, N>>
Sourcepub fn up(&mut self) -> bool
pub fn up(&mut self) -> bool
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.
Sourcepub fn take<'s>(&'s mut self) -> Option<TreeCursor<'n, 's, N>>
pub fn take<'s>(&'s mut self) -> Option<TreeCursor<'n, 's, N>>
Takes the active node from this TreeCursor
and returns a new
TreeCursor
at that position. self
is frozen until the new cursor
goes out of scope.
Source§impl<'n: 'f, 'f, N: 'n + Down> TreeCursor<'n, 'f, N>
impl<'n: 'f, 'f, N: 'n + Down> TreeCursor<'n, 'f, N>
Sourcepub fn down(&mut self) -> bool
pub fn down(&mut self) -> bool
Moves the cursor down one node. The node to move to is determined by
calling Down::down
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.
Sourcepub fn down_new<'s>(&'s mut self) -> Option<TreeCursor<'n, 's, N>>
pub fn down_new<'s>(&'s mut self) -> Option<TreeCursor<'n, 's, N>>
Like down
, except instead of moving the position of self
, it
returns a new TreeCursor
whose root is the new position. self
is
frozen until the new cursor goes out of scope.
Trait Implementations§
Source§impl<'n: 'f, 'f, N: Clone + 'n> Clone for TreeCursor<'n, 'f, N>
impl<'n: 'f, 'f, N: Clone + 'n> Clone for TreeCursor<'n, 'f, N>
Source§fn clone(&self) -> TreeCursor<'n, 'f, N>
fn clone(&self) -> TreeCursor<'n, 'f, N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more