Struct cursive::menu::MenuTree
[−]
[src]
pub struct MenuTree { pub children: Vec<MenuItem>, }
Root of a menu tree.
Fields
children: Vec<MenuItem>
Menu items
Methods
impl MenuTree
[src]
fn new() -> Self
Creates a new, empty tree.
fn clear(&mut self)
Remove every children from this tree.
fn insert_delimiter(&mut self, i: usize)
Inserts a delimiter at the given position.
fn add_delimiter(&mut self)
Adds a delimiter to the end of this tree.
fn delimiter(self) -> Self
Adds a delimiter to the end of this tree - chainable variant.
fn add_leaf<S, F>(&mut self, title: S, cb: F) where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Adds a actionnable leaf to the end of this tree.
fn insert_leaf<S, F>(&mut self, i: usize, title: S, cb: F) where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Inserts a leaf at the given position.
fn leaf<S, F>(self, title: S, cb: F) -> Self where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Adds a actionnable leaf to the end of this tree - chainable variant.
fn insert_subtree<S>(&mut self, i: usize, title: S, tree: MenuTree) where
S: Into<String>,
S: Into<String>,
Inserts a subtree at the given position.
fn add_subtree<S>(&mut self, title: S, tree: MenuTree) where
S: Into<String>,
S: Into<String>,
Adds a submenu to the end of this tree.
fn subtree<S>(self, title: S, tree: MenuTree) -> Self where
S: Into<String>,
S: Into<String>,
Adds a submenu to the end of this tree - chainable variant.
fn find_item(&mut self, title: &str) -> Option<&mut MenuItem>
Looks for a child with the given title.
Returns None
if no such label was found.
fn find_position(&mut self, title: &str) -> Option<usize>
Returns the position of a child with the given label.
Returns None
if no such label was found.
fn find_subtree(&mut self, title: &str) -> Option<&mut MenuTree>
Looks for a subtree child with the given label.
Returns None
if the given title was not found,
or if it wasn't a subtree.
fn remove(&mut self, i: usize)
Removes the item at the given position.
fn len(&self) -> usize
Returns the number of direct children in this node.
- Includes delimiters.
- Does not count nested children.
fn is_empty(&self) -> bool
Returns true
if this tree has no children.
Trait Implementations
impl Default for MenuTree
[src]
impl Clone for MenuTree
[src]
fn clone(&self) -> MenuTree
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more