Struct SubMenu

Source
pub struct SubMenu {
    pub level: i64,
    pub lines: Vec<SubMenuItem>,
}
Expand description

SubMenu contains a slice of SubMenuItems which can be Lines or additional SubMenus. The Level indicates how nested the submenu is which is used during render to prepend the correct number of -- prefixes.

Fields§

§level: i64§lines: Vec<SubMenuItem>

Implementations§

Source§

impl SubMenu

Source

pub fn new() -> Self

Function to create empty sub menu

Examples found in repository?
examples/simple.rs (line 8)
3fn main() {
4    let mut pl = Plugin::new();
5    let mut line = Line::new("first line");
6    line.set_color("red").set_href("http://google.com");
7
8    let mut sub_menu = SubMenu::new();
9    sub_menu.add_line(line);
10
11    let status_line = Line::new("🍺🍺🍺");
12    pl.set_status_line(status_line).set_sub_menu(sub_menu);
13
14    pl.render();
15}
Source

pub fn add_line(&mut self, line: Line) -> &mut Self

Line creates a line adding text to the dropdown which will be added after the main dropdown delimiter (---).

Examples found in repository?
examples/simple.rs (line 9)
3fn main() {
4    let mut pl = Plugin::new();
5    let mut line = Line::new("first line");
6    line.set_color("red").set_href("http://google.com");
7
8    let mut sub_menu = SubMenu::new();
9    sub_menu.add_line(line);
10
11    let status_line = Line::new("🍺🍺🍺");
12    pl.set_status_line(status_line).set_sub_menu(sub_menu);
13
14    pl.render();
15}
Source

pub fn add_sub_menu(&mut self, sub_menu: SubMenu) -> &mut Self

NewSubMenu creates a nested submenu off a submenu.

Source

pub fn add_hr(&mut self) -> &mut Self

HR turns a line into a horizontal delimiter, useful for breaking menu items into logical groups.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.