Enum cursive_core::menu::Item

source ·
pub enum Item {
    Leaf {
        label: String,
        cb: Callback,
        enabled: bool,
    },
    Subtree {
        label: String,
        tree: Rc<Tree>,
        enabled: bool,
    },
    Delimiter,
}
Expand description

Node in the menu tree.

Variants§

§

Leaf

Fields

§label: String

Text displayed for this entry.

§cb: Callback

Callback to run when the entry is selected.

§enabled: bool

Whether this item is enabled.

Disabled items cannot be selected and are displayed grayed out.

Actionnable button with a label.

§

Subtree

Fields

§label: String

Text displayed for this entry.

§tree: Rc<Tree>

Subtree under this item.

§enabled: bool

Whether this item is enabled.

Disabled items cannot be selected and are displayed grayed out.

Sub-menu with a label.

§

Delimiter

Delimiter without a label.

Implementations§

Create a new leaf menu item.

Create a new subtree menu item.

Returns the label for this item.

Returns a vertical bar string if self is a delimiter.

Returns true if this item is enabled.

Only labels and subtrees can be enabled. Delimiters

Return a disabled version of this item.

Disable this item.

Disabled items cannot be selected and are shown grayed out.

Does not affect delimiters.

Returns true if self is a delimiter.

Returns true if self is a leaf node.

Returns true if self is a subtree.

Return a mutable reference to the subtree, if applicable.

Returns None if self is not a Item::Subtree.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.