pub struct KeyboardShortcut { /* private fields */ }Implementations§
Source§impl KeyboardShortcut
impl KeyboardShortcut
pub fn new(key: impl AsRef<str>) -> Self
Sourcepub fn builder(key: impl AsRef<str>) -> KeyboardShortcutBuilder
pub fn builder(key: impl AsRef<str>) -> KeyboardShortcutBuilder
Initialize a new keyboard shortcut builder with the specified key.
Sourcepub fn with_modifiers(key: impl AsRef<str>, modifiers: &[ModifierKey]) -> Self
pub fn with_modifiers(key: impl AsRef<str>, modifiers: &[ModifierKey]) -> Self
Create a new keyboard shortcut with the specified key and modifiers.
Sourcepub fn with_alt(key: impl AsRef<str>) -> Self
pub fn with_alt(key: impl AsRef<str>) -> Self
Create a new keyboard shortcut with the specified key and the AltKey modifier.
§Example
use tauri_plugin_prevent_default::KeyboardShortcut;
use tauri_plugin_prevent_default::ModifierKey::AltKey;
// Both of these are equivalent.
tauri_plugin_prevent_default::Builder::new()
.shortcut(KeyboardShortcut::with_alt("A"))
.shortcut(KeyboardShortcut::with_modifiers("A", &[AltKey]))
.build();Sourcepub fn with_ctrl(key: impl AsRef<str>) -> Self
pub fn with_ctrl(key: impl AsRef<str>) -> Self
Create a new keyboard shortcut with the specified key and the CtrlKey modifier.
Sourcepub fn with_ctrl_meta(key: impl AsRef<str>) -> Self
pub fn with_ctrl_meta(key: impl AsRef<str>) -> Self
Create a new keyboard shortcut with the specified key and the CtrlKey and MetaKey modifiers.
Sourcepub fn with_ctrl_shift(key: impl AsRef<str>) -> Self
pub fn with_ctrl_shift(key: impl AsRef<str>) -> Self
Create a new keyboard shortcut with the specified key and the CtrlKey and ShiftKey modifiers.
Sourcepub fn with_meta(key: impl AsRef<str>) -> Self
pub fn with_meta(key: impl AsRef<str>) -> Self
Create a new keyboard shortcut with the specified key and the MetaKey modifier.
Sourcepub fn with_shift(key: impl AsRef<str>) -> Self
pub fn with_shift(key: impl AsRef<str>) -> Self
Create a new keyboard shortcut with the specified key and the ShiftKey modifier.
Sourcepub fn with_shift_alt(key: impl AsRef<str>) -> Self
pub fn with_shift_alt(key: impl AsRef<str>) -> Self
Create a new keyboard shortcut with the specified key and the ShiftKey and AltKey modifiers.
Sourcepub fn with_shift_meta(key: impl AsRef<str>) -> Self
pub fn with_shift_meta(key: impl AsRef<str>) -> Self
Create a new keyboard shortcut with the specified key and the ShiftKey and MetaKey modifiers.
Sourcepub fn modifiers(&self) -> &[ModifierKey]
pub fn modifiers(&self) -> &[ModifierKey]
The modifiers of the shortcut.
Trait Implementations§
Source§impl Debug for KeyboardShortcut
impl Debug for KeyboardShortcut
Source§impl Display for KeyboardShortcut
impl Display for KeyboardShortcut
Source§impl Shortcut for KeyboardShortcut
impl Shortcut for KeyboardShortcut
fn kind(&self) -> ShortcutKind<'_>
Auto Trait Implementations§
impl Freeze for KeyboardShortcut
impl RefUnwindSafe for KeyboardShortcut
impl Send for KeyboardShortcut
impl Sync for KeyboardShortcut
impl Unpin for KeyboardShortcut
impl UnwindSafe for KeyboardShortcut
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more