[][src]Struct cursive::menu::MenuTree

pub struct MenuTree {
    pub children: Vec<MenuItem>,
}

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]

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]

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]

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]

Inserts a subtree at the given position.

pub fn add_subtree<S>(&mut self, title: S, tree: MenuTree) where
    S: Into<String>, 
[src]

Adds a submenu to the end of this tree.

pub fn subtree<S>(self, title: S, tree: MenuTree) -> Self where
    S: Into<String>, 
[src]

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_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]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T[src]