objc2_intents/generated/
INShortcut.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10    /// A shortcut is an action that can be suggested by the system or added to Siri.
11    ///
12    /// See also [Apple's documentation](https://developer.apple.com/documentation/intents/inshortcut?language=objc)
13    #[unsafe(super(NSObject))]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct INShortcut;
16);
17
18extern_conformance!(
19    unsafe impl NSCoding for INShortcut {}
20);
21
22extern_conformance!(
23    unsafe impl NSCopying for INShortcut {}
24);
25
26unsafe impl CopyingHelper for INShortcut {
27    type Result = Self;
28}
29
30extern_conformance!(
31    unsafe impl NSObjectProtocol for INShortcut {}
32);
33
34extern_conformance!(
35    unsafe impl NSSecureCoding for INShortcut {}
36);
37
38impl INShortcut {
39    extern_methods!(
40        #[cfg(feature = "INIntent")]
41        /// The intent that will be performed when this shortcut is invoked.
42        ///
43        /// Is
44        /// `nil`if the shortcut was created with a
45        /// `NSUserActivity.`
46        #[unsafe(method(intent))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn intent(&self) -> Option<Retained<INIntent>>;
49
50        /// The user activity that will be performed when this shortcut is invoked.
51        ///
52        /// Is
53        /// `nil`if the shortcut was created with an
54        /// `INIntent.`
55        #[unsafe(method(userActivity))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn userActivity(&self) -> Option<Retained<NSUserActivity>>;
58
59        /// Note: Must be initilaized with either an intent or user activity, using those initializers.
60        #[unsafe(method(new))]
61        #[unsafe(method_family = new)]
62        pub unsafe fn new() -> Retained<Self>;
63
64        /// Note: Must be initilaized with either an intent or user activity, using those initializers.
65        #[unsafe(method(init))]
66        #[unsafe(method_family = init)]
67        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
68
69        #[cfg(feature = "INIntent")]
70        /// Creates a shortcut with the given intent.
71        ///
72        /// Parameter `intent`: Unless user configurable, must have a title and have valid shortcut types.
73        ///
74        /// Returns: Will return
75        /// `nil`(and log an error) if the intent isn't valid.
76        #[unsafe(method(initWithIntent:))]
77        #[unsafe(method_family = init)]
78        pub unsafe fn initWithIntent(
79            this: Allocated<Self>,
80            intent: &INIntent,
81        ) -> Option<Retained<Self>>;
82
83        /// Creates a shortcut with the given user activity.
84        #[unsafe(method(initWithUserActivity:))]
85        #[unsafe(method_family = init)]
86        pub unsafe fn initWithUserActivity(
87            this: Allocated<Self>,
88            user_activity: &NSUserActivity,
89        ) -> Retained<Self>;
90    );
91}