pub struct TreeState { /* private fields */ }Expand description
Tree state tracks the current state for the component tree.
Implementations§
Source§impl TreeState
impl TreeState
Sourcepub fn is_selected<V>(&self, node: &Node<V>) -> bool
pub fn is_selected<V>(&self, node: &Node<V>) -> bool
Returns whether provided node is currently selected
Sourcepub fn first_sibling<'a, V>(&self, tree: &'a Node<V>) -> Option<&'a Node<V>>
pub fn first_sibling<'a, V>(&self, tree: &'a Node<V>) -> Option<&'a Node<V>>
Get first sibling in children of current selected node’s parent
Sourcepub fn last_sibling<'a, V>(&self, tree: &'a Node<V>) -> Option<&'a Node<V>>
pub fn last_sibling<'a, V>(&self, tree: &'a Node<V>) -> Option<&'a Node<V>>
Get last sibling in children of current selected node’s parent
Sourcepub fn tree_changed<V>(&mut self, root: &Node<V>, preserve: bool)
pub fn tree_changed<V>(&mut self, root: &Node<V>, preserve: bool)
The tree has changed, so this method must check whether to keep states or not
Sourcepub fn open<V>(&mut self, root: &Node<V>)
pub fn open<V>(&mut self, root: &Node<V>)
Open currently selected node. Node can be open only if it is closed and it is NOT a leaf
Sourcepub fn close<V>(&mut self, root: &Node<V>)
pub fn close<V>(&mut self, root: &Node<V>)
Close currently selected node.
If node has children, then all children are closed recursively
Sourcepub fn move_down<V>(&mut self, root: &Node<V>)
pub fn move_down<V>(&mut self, root: &Node<V>)
Move cursor down in current tree from current position. Rewind if required
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TreeState
impl RefUnwindSafe for TreeState
impl Send for TreeState
impl Sync for TreeState
impl Unpin for TreeState
impl UnwindSafe for TreeState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more