[−][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
impl Clone for MenuTree
[src]
fn clone(&self) -> MenuTree
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for MenuTree
[src]
Auto Trait Implementations
impl !Sync for MenuTree
impl !Send for MenuTree
impl Unpin for MenuTree
impl !RefUnwindSafe for MenuTree
impl !UnwindSafe for MenuTree
Blanket Implementations
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,