pub struct Cursor<'a, T> { /* private fields */ }
Expand description
Cursor over the tree elements.
If a move operation fails we Return
a result with:
Ok
: the moved cursorErr
: the previous unmodified cursor
Implementations§
Source§impl<T> Cursor<'_, T>
impl<T> Cursor<'_, T>
pub fn id(&self) -> NodeId
pub fn get(&self) -> &T
pub fn get_mut(&mut self) -> &mut T
Sourcepub fn first_child(&mut self) -> Result<&mut Self, &mut Self>
pub fn first_child(&mut self) -> Result<&mut Self, &mut Self>
Move the cursor to the first child
§Errors
If there is no next node will return the previous position
Sourcepub fn last_child(&mut self) -> Result<&mut Self, &mut Self>
pub fn last_child(&mut self) -> Result<&mut Self, &mut Self>
Move the cursor to the last child
§Errors
If there is no next node will return the previous position
Sourcepub fn next_sibling(&mut self) -> Result<&mut Self, &mut Self>
pub fn next_sibling(&mut self) -> Result<&mut Self, &mut Self>
Move the cursor to the next sibling
§Errors
If there is no next node will return the previous position
Sourcepub fn prev_sibling(&mut self) -> Result<&mut Self, &mut Self>
pub fn prev_sibling(&mut self) -> Result<&mut Self, &mut Self>
Move the cursor to the prev sibling
§Errors
If there is no next node will return the previous position
pub fn append_child(&mut self, value: T) -> NodeId
pub fn append_sibling(&mut self, value: T) -> NodeId
pub fn peek_parent(&self) -> Option<&T>
pub fn peek_next_sibling(&self) -> Option<&T>
pub fn peek_prev_sibling(&self) -> Option<&T>
pub fn peek_first_child(&self) -> Option<&T>
pub fn peek_last_child(&self) -> Option<&T>
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for Cursor<'a, T>
impl<'a, T> RefUnwindSafe for Cursor<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Cursor<'a, T>where
T: Send,
impl<'a, T> Sync for Cursor<'a, T>where
T: Sync,
impl<'a, T> Unpin for Cursor<'a, T>
impl<'a, T> !UnwindSafe for Cursor<'a, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more