pub struct MenuItem<'a> {
    pub id: usize,
    pub label: String,
    pub enabled: bool,
    pub key: Key,
    pub modifier: usize,
    /* private fields */
}
Expand description

Holds info about each item in a menu

Fields

id: usizelabel: Stringenabled: boolkey: Keymodifier: usize

Implementations

Creates a new menu item

Sets a shortcut key and modifer (and returns itself)

Examples
menu.add_item("test", 1).shortcut(Key::A, 0).build()

Sets item to a separator

Examples
menu.add_item("", 0).separator().build()

Notice that it’s usually easier to just call menu.add_separator() directly

Sets the menu item disabled/or not

Examples
menu.add_item("test", 1).enabled(false).build()

Must be called to finalize building of a menu item when started with menu.add_item()

Examples
menu.add_item("test", 1).enabled(false).build()

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. 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.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.