pub struct Shortcut { /* private fields */ }Expand description
An object representing a single shortcut in the Shortcuts app
Implementations§
Source§impl Shortcut
impl Shortcut
Sourcepub fn load() -> Result<Vec<Shortcut>, Box<dyn Error>>
pub fn load() -> Result<Vec<Shortcut>, Box<dyn Error>>
Load the current set of shortcuts defined in the Shortcuts app. This will load all shortcuts regardless of folder.
This method currently uses a small AppleScript snippet and executes this using osascript.
Sourcepub fn load_folder(folder: &str) -> Result<Vec<Shortcut>, Box<dyn Error>>
pub fn load_folder(folder: &str) -> Result<Vec<Shortcut>, Box<dyn Error>>
Load the current set of shortcuts defined in the Shortcuts app in the given folder.
This method currently uses a small AppleScript snippet and executes this using osascript.
Sourcepub fn folder(&self) -> Option<&str>
pub fn folder(&self) -> Option<&str>
Get the folder name that this shortcut is contained within or None
if the shortcut isn’t in a folder
Sourcepub fn icon(&self) -> &DynamicImage
pub fn icon(&self) -> &DynamicImage
Get the icon defined for this shortcut. The dimensions of the icon are driven by the AppleScript and the Shortcuts app used to load the data
Trait Implementations§
Source§impl Ord for Shortcut
impl Ord for Shortcut
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Shortcut
impl PartialOrd for Shortcut
impl Eq for Shortcut
Auto Trait Implementations§
impl Freeze for Shortcut
impl RefUnwindSafe for Shortcut
impl Send for Shortcut
impl Sync for Shortcut
impl Unpin for Shortcut
impl UnsafeUnpin for Shortcut
impl UnwindSafe for Shortcut
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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