Struct tauri_runtime::menu::Menu
source · [−]Expand description
A window menu.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.items: Vec<MenuEntry>
Implementations
sourceimpl Menu
impl Menu
sourcepub fn with_items<I: IntoIterator<Item = MenuEntry>>(items: I) -> Self
pub fn with_items<I: IntoIterator<Item = MenuEntry>>(items: I) -> Self
Creates a new window menu with the given items.
Example
Menu::with_items([
MenuItem::SelectAll.into(),
#[cfg(target_os = "macos")]
MenuItem::Redo.into(),
CustomMenuItem::new("toggle", "Toggle visibility").into(),
Submenu::new("View", Menu::new()).into(),
]);
sourcepub fn add_item(self, item: CustomMenuItem) -> Self
pub fn add_item(self, item: CustomMenuItem) -> Self
Adds the custom menu item to the menu.
sourcepub fn add_native_item(self, item: MenuItem) -> Self
pub fn add_native_item(self, item: MenuItem) -> Self
Adds a native item to the menu.
Adds an entry with submenu.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Menu
impl Send for Menu
impl Sync for Menu
impl Unpin for Menu
impl UnwindSafe for Menu
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more