pub struct MutCursorVec<'root, T: ?Sized + 'root> { /* private fields */ }alloc only.Expand description
Implementations§
Source§impl<'root, T: ?Sized + 'root> MutCursorVec<'root, T>
impl<'root, T: ?Sized + 'root> MutCursorVec<'root, T>
Sourcepub fn new(root: &'root mut T) -> Self
pub fn new(root: &'root mut T) -> Self
Returns a new MutCursorVec with a reference to the specified root
Sourcepub fn new_with_capacity(root: &'root mut T, capacity: usize) -> Self
pub fn new_with_capacity(root: &'root mut T, capacity: usize) -> Self
Returns a new MutCursorVec with a reference to the specified root, and an allocated buffer
for capacity references
Sourcepub fn top(&self) -> &T
pub fn top(&self) -> &T
Returns a const reference from the mutable reference on the top of the stack
Sourcepub fn into_mut(self) -> &'root mut T
pub fn into_mut(self) -> &'root mut T
Returns the mutable reference on the top of the stack, consuming the stack
Sourcepub fn try_map_into_mut<U, E, F>(self, f: F) -> Result<&'root mut U, (Self, E)>
pub fn try_map_into_mut<U, E, F>(self, f: F) -> Result<&'root mut U, (Self, E)>
Consumes the stack and returns a mutable reference to an object with the 'root lifetime,
if a closure returns Ok, otherwise returns the stack and a custom error value
NOTE: Usage is identical to MutCursor::try_map_into_mut
Sourcepub fn depth(&self) -> usize
pub fn depth(&self) -> usize
Returns the number of excess references stored in the stack, which corresponds to the number of
times backtrack may be called
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of references the stack is capable of holding without reallocation
Sourcepub fn advance<F>(&mut self, step_f: F) -> bool
pub fn advance<F>(&mut self, step_f: F) -> bool
Steps deeper into the traversal, pushing a new reference onto the top of the stack
If the step_f closure returns Some(), the contained reference is pushed onto the stack and
this method returns true. If the closure returns None then the stack is unmodified and this
method returns false.