Struct cursive_core::menu::Tree
source · Expand description
Root of a menu tree.
Fields§
§children: Vec<Item>
Menu items
Implementations§
source§impl 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) -> Selfwhere
S: Into<String>,
F: 'static + Fn(&mut Cursive),
pub fn leaf<S, F>(self, label: S, cb: F) -> Selfwhere
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) -> Selfwhere
S: Into<String>,
pub fn subtree<S>(self, label: S, tree: Tree) -> Selfwhere
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.