pub struct Location<T: Clone> {
pub cursor: Tree<T>,
pub path: Rc<Path<T>>,
}Expand description
Represents a location (cursor) within a tree.
A location combines a cursor pointing to the current tree node and a path providing context for navigation within the overall tree structure.
Fields§
§cursor: Tree<T>The current tree node being focused on.
path: Rc<Path<T>>The path representing the context of this location within the overall tree.
Implementations§
Source§impl<T: Clone> Location<T>
impl<T: Clone> Location<T>
Sourcepub fn go_left(self) -> Option<Self>
pub fn go_left(self) -> Option<Self>
Moves the cursor to the left sibling.
§Returns
Some(Location)- If there is a left sibling.None- If there is no left sibling or the location is at the top.
Sourcepub fn go_right(self) -> Option<Self>
pub fn go_right(self) -> Option<Self>
Moves the cursor to the right sibling.
§Returns
Some(Location)- If there is a right sibling.None- If there is no right sibling or the location is at the top.
Sourcepub fn go_up(self) -> Option<Self>
pub fn go_up(self) -> Option<Self>
Moves the cursor to the parent node.
§Returns
Some(Location)- If there is a parent node.None- If the location is at the top.
Sourcepub fn go_down(self) -> Option<Self>
pub fn go_down(self) -> Option<Self>
Moves the cursor to the first child node.
§Returns
Some(Location)- If the current node is a section with at least one child.None- If the current node is an item or an empty section.
Sourcepub fn insert_right(self, tree: Tree<T>) -> Option<Self>
pub fn insert_right(self, tree: Tree<T>) -> Option<Self>
Sourcepub fn insert_left(self, tree: Tree<T>) -> Option<Self>
pub fn insert_left(self, tree: Tree<T>) -> Option<Self>
Sourcepub fn insert_down(self, tree: Tree<T>) -> Option<Self>
pub fn insert_down(self, tree: Tree<T>) -> Option<Self>
Trait Implementations§
Source§impl<T: PartialEq + Clone> PartialEq for Location<T>
impl<T: PartialEq + Clone> PartialEq for Location<T>
impl<T: Clone> StructuralPartialEq for Location<T>
Auto Trait Implementations§
impl<T> Freeze for Location<T>where
T: Freeze,
impl<T> RefUnwindSafe for Location<T>where
T: RefUnwindSafe,
impl<T> !Send for Location<T>
impl<T> !Sync for Location<T>
impl<T> Unpin for Location<T>where
T: Unpin,
impl<T> UnsafeUnpin for Location<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Location<T>where
T: UnwindSafe + RefUnwindSafe,
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