Expand description
Root of a menu tree.
Fields
children: Vec<Item, Global>
Menu items
Implementations
sourceimpl Tree
impl Tree
sourcepub fn insert_delimiter(&mut self, i: usize)
pub fn insert_delimiter(&mut self, i: usize)
Inserts a delimiter at the given position.
sourcepub fn add_delimiter(&mut self)
pub fn add_delimiter(&mut self)
Adds a delimiter to the end of this tree.
sourcepub fn add_leaf<S, F>(&mut self, label: S, cb: F)where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
pub fn add_leaf<S, F>(&mut self, label: S, cb: F)where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Adds a actionnable leaf to the end of this tree.
sourcepub fn insert_leaf<S, F>(&mut self, i: usize, label: S, cb: F)where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
pub fn insert_leaf<S, F>(&mut self, i: usize, label: S, cb: F)where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Inserts a leaf at the given position.
sourcepub fn leaf<S, F>(self, label: S, cb: F) -> Treewhere
S: Into<String>,
F: 'static + Fn(&mut Cursive),
pub fn leaf<S, F>(self, label: S, cb: F) -> Treewhere
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Adds a actionnable leaf to the end of this tree - chainable variant.
sourcepub fn insert_subtree<S>(&mut self, i: usize, label: S, tree: Tree)where
S: Into<String>,
pub fn insert_subtree<S>(&mut self, i: usize, label: S, tree: Tree)where
S: Into<String>,
Inserts a subtree at the given position.
sourcepub fn add_subtree<S>(&mut self, label: S, tree: Tree)where
S: Into<String>,
pub fn add_subtree<S>(&mut self, label: S, tree: Tree)where
S: Into<String>,
Adds a submenu to the end of this tree.
sourcepub fn subtree<S>(self, label: S, tree: Tree) -> Treewhere
S: Into<String>,
pub fn subtree<S>(self, label: S, tree: Tree) -> Treewhere
S: Into<String>,
Adds a submenu to the end of this tree - chainable variant.
sourcepub fn get_mut(&mut self, i: usize) -> Option<&mut Item>
pub fn get_mut(&mut self, i: usize) -> Option<&mut Item>
Looks for the child at the given position.
Returns None
if i >= self.len()
.
sourcepub fn get_subtree(&mut self, i: usize) -> Option<&mut Tree>
pub fn get_subtree(&mut self, i: usize) -> Option<&mut Tree>
Returns the item at the given position.
Returns None
if i > self.len()
or if the item is not a subtree.
sourcepub fn find_item(&mut self, label: &str) -> Option<&mut Item>
pub fn find_item(&mut self, label: &str) -> Option<&mut Item>
Looks for a child with the given label.
Returns None
if no such label was found.
sourcepub fn find_subtree(&mut self, label: &str) -> Option<&mut Tree>
pub fn find_subtree(&mut self, label: &str) -> Option<&mut Tree>
Looks for a subtree with the given label.
sourcepub fn find_position(&mut self, label: &str) -> Option<usize>
pub fn find_position(&mut self, label: &str) -> Option<usize>
Returns the position of a child with the given label.
Returns None
if no such label was found.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Tree
impl !Send for Tree
impl !Sync for Tree
impl Unpin for Tree
impl !UnwindSafe for Tree
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more