[−][src]Struct cursive::menu::MenuTree
Root of a menu tree.
Fields
children: Vec<MenuItem>
Menu items
Methods
impl MenuTree
[src]
pub fn new() -> Self
[src]
Creates a new, empty tree.
pub fn clear(&mut self)
[src]
Remove every children from this tree.
pub fn insert(&mut self, i: usize, item: MenuItem)
[src]
Inserts an item at the given position.
pub fn insert_delimiter(&mut self, i: usize)
[src]
Inserts a delimiter at the given position.
pub fn add_delimiter(&mut self)
[src]
Adds a delimiter to the end of this tree.
pub fn delimiter(self) -> Self
[src]
Adds a delimiter to the end of this tree - chainable variant.
pub fn add_leaf<S, F>(&mut self, title: S, cb: F) where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
[src]
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Adds a actionnable leaf to the end of this tree.
pub fn insert_leaf<S, F>(&mut self, i: usize, title: S, cb: F) where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
[src]
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Inserts a leaf at the given position.
pub fn leaf<S, F>(self, title: S, cb: F) -> Self where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
[src]
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Adds a actionnable leaf to the end of this tree - chainable variant.
pub fn insert_subtree<S>(&mut self, i: usize, title: S, tree: MenuTree) where
S: Into<String>,
[src]
S: Into<String>,
Inserts a subtree at the given position.
pub fn add_subtree<S>(&mut self, title: S, tree: MenuTree) where
S: Into<String>,
[src]
S: Into<String>,
Adds a submenu to the end of this tree.
pub fn subtree<S>(self, title: S, tree: MenuTree) -> Self where
S: Into<String>,
[src]
S: Into<String>,
Adds a submenu to the end of this tree - chainable variant.
pub fn get_mut(&mut self, i: usize) -> Option<&mut MenuItem>
[src]
Looks for the child at the given position.
Returns None
if i >= self.len()
.
pub fn get_subtree(&mut self, i: usize) -> Option<&mut MenuTree>
[src]
Returns the item at the given position.
Returns None
if i > self.len()
or if the item is not a subtree.
pub fn find_item(&mut self, title: &str) -> Option<&mut MenuItem>
[src]
Looks for a child with the given title.
Returns None
if no such label was found.
pub fn find_subtree(&mut self, title: &str) -> Option<&mut MenuTree>
[src]
Looks for a subtree with the given title.
pub fn find_position(&mut self, title: &str) -> Option<usize>
[src]
Returns the position of a child with the given label.
Returns None
if no such label was found.
pub fn remove(&mut self, i: usize)
[src]
Removes the item at the given position.
pub fn len(&self) -> usize
[src]
Returns the number of direct children in this node.
- Includes delimiters.
- Does not count nested children.
pub fn is_empty(&self) -> bool
[src]
Returns true
if this tree has no children.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for MenuTree
impl !Send for MenuTree
impl !Sync for MenuTree
impl Unpin for MenuTree
impl !UnwindSafe for MenuTree
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,