Struct NullCommand

Source
pub struct NullCommand { /* private fields */ }

Implementations§

Source§

impl NullCommand

Source

pub fn hotkey(self, key: HotKey) -> Self

Adds a hotkey to the menu command.

Source

pub fn action<F: Fn()>(self, func: F) -> Command2<F>

Adds an action to the menu command.

Examples found in repository?
examples/menu.rs (line 21)
6fn main() {
7    rui(hstack((
8        circle()
9            .color(RED_HIGHLIGHT)
10            .padding(Auto)
11            .command("File:New", Some(HotKey::KeyN), |_| println!("new")),
12        rectangle()
13            .corner_radius(5.0)
14            .color(AZURE_HIGHLIGHT)
15            .padding(Auto)
16            .command("Edit:Two", None, |_| println!("two"))
17            .command("Edit:Three", None, |_| println!("three"))
18            .command("Custom:Submenu:One", None, |_| println!("submenu one"))
19            .command("Custom:Submenu:Two", None, |_| println!("submenu two"))
20            .command_group((command("Custom 2:Four")
21                .action(|| println!("four"))
22                .hotkey(HotKey::KeyF),)),
23    )));
24}

Trait Implementations§

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>