tauri::menu

Struct IconMenuItemBuilder

source
pub struct IconMenuItemBuilder<'a> { /* private fields */ }
Available on desktop only.
Expand description

A builder type for IconMenuItem

Implementations§

source§

impl<'a> IconMenuItemBuilder<'a>

source

pub fn new<S: AsRef<str>>(text: S) -> Self

Create a new menu item builder.

  • text could optionally contain an & before a character to assign this character as the mnemonic for this menu item. To display a & without assigning a mnemenonic, use &&.
source

pub fn with_id<I: Into<MenuId>, S: AsRef<str>>(id: I, text: S) -> Self

Create a new menu item builder with the specified id.

  • text could optionally contain an & before a character to assign this character as the mnemonic for this menu item. To display a & without assigning a mnemenonic, use &&.
source

pub fn id<I: Into<MenuId>>(self, id: I) -> Self

Set the id for this menu item.

source

pub fn enabled(self, enabled: bool) -> Self

Set the enabled state for this menu item.

source

pub fn accelerator<S: AsRef<str>>(self, accelerator: S) -> Self

Set the accelerator for this menu item.

source

pub fn icon(self, icon: Image<'a>) -> Self

Set the icon for this menu item.

Note: This method conflicts with Self::native_icon so calling one of them, will reset the other.

source

pub fn native_icon(self, icon: NativeIcon) -> Self

Set the icon for this menu item.

Note: This method conflicts with Self::icon so calling one of them, will reset the other.

source

pub fn build<R: Runtime, M: Manager<R>>( self, manager: &M, ) -> Result<IconMenuItem<R>>

Build the menu item

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.