objc2_foundation/generated/
NSUserScriptTask.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsuserscripttaskcompletionhandler?language=objc)
10#[cfg(all(feature = "NSError", feature = "block2"))]
11pub type NSUserScriptTaskCompletionHandler = *mut block2::DynBlock<dyn Fn(*mut NSError)>;
12
13extern_class!(
14    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsuserscripttask?language=objc)
15    #[unsafe(super(NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    pub struct NSUserScriptTask;
18);
19
20extern_conformance!(
21    unsafe impl NSObjectProtocol for NSUserScriptTask {}
22);
23
24impl NSUserScriptTask {
25    extern_methods!(
26        #[cfg(all(feature = "NSError", feature = "NSURL"))]
27        #[unsafe(method(initWithURL:error:_))]
28        #[unsafe(method_family = init)]
29        pub fn initWithURL_error(
30            this: Allocated<Self>,
31            url: &NSURL,
32        ) -> Result<Retained<Self>, Retained<NSError>>;
33
34        #[cfg(feature = "NSURL")]
35        #[unsafe(method(scriptURL))]
36        #[unsafe(method_family = none)]
37        pub fn scriptURL(&self) -> Retained<NSURL>;
38
39        #[cfg(all(feature = "NSError", feature = "block2"))]
40        /// # Safety
41        ///
42        /// `handler` must be a valid pointer or null.
43        #[unsafe(method(executeWithCompletionHandler:))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn executeWithCompletionHandler(
46            &self,
47            handler: NSUserScriptTaskCompletionHandler,
48        );
49    );
50}
51
52/// Methods declared on superclass `NSObject`.
53impl NSUserScriptTask {
54    extern_methods!(
55        #[unsafe(method(init))]
56        #[unsafe(method_family = init)]
57        pub fn init(this: Allocated<Self>) -> Retained<Self>;
58
59        #[unsafe(method(new))]
60        #[unsafe(method_family = new)]
61        pub fn new() -> Retained<Self>;
62    );
63}
64
65impl DefaultRetained for NSUserScriptTask {
66    #[inline]
67    fn default_retained() -> Retained<Self> {
68        Self::new()
69    }
70}
71
72/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsuserunixtaskcompletionhandler?language=objc)
73#[cfg(all(feature = "NSError", feature = "block2"))]
74pub type NSUserUnixTaskCompletionHandler = *mut block2::DynBlock<dyn Fn(*mut NSError)>;
75
76extern_class!(
77    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsuserunixtask?language=objc)
78    #[unsafe(super(NSUserScriptTask, NSObject))]
79    #[derive(Debug, PartialEq, Eq, Hash)]
80    pub struct NSUserUnixTask;
81);
82
83extern_conformance!(
84    unsafe impl NSObjectProtocol for NSUserUnixTask {}
85);
86
87impl NSUserUnixTask {
88    extern_methods!(
89        #[cfg(feature = "NSFileHandle")]
90        #[unsafe(method(standardInput))]
91        #[unsafe(method_family = none)]
92        pub fn standardInput(&self) -> Option<Retained<NSFileHandle>>;
93
94        #[cfg(feature = "NSFileHandle")]
95        /// Setter for [`standardInput`][Self::standardInput].
96        #[unsafe(method(setStandardInput:))]
97        #[unsafe(method_family = none)]
98        pub fn setStandardInput(&self, standard_input: Option<&NSFileHandle>);
99
100        #[cfg(feature = "NSFileHandle")]
101        #[unsafe(method(standardOutput))]
102        #[unsafe(method_family = none)]
103        pub fn standardOutput(&self) -> Option<Retained<NSFileHandle>>;
104
105        #[cfg(feature = "NSFileHandle")]
106        /// Setter for [`standardOutput`][Self::standardOutput].
107        #[unsafe(method(setStandardOutput:))]
108        #[unsafe(method_family = none)]
109        pub fn setStandardOutput(&self, standard_output: Option<&NSFileHandle>);
110
111        #[cfg(feature = "NSFileHandle")]
112        #[unsafe(method(standardError))]
113        #[unsafe(method_family = none)]
114        pub fn standardError(&self) -> Option<Retained<NSFileHandle>>;
115
116        #[cfg(feature = "NSFileHandle")]
117        /// Setter for [`standardError`][Self::standardError].
118        #[unsafe(method(setStandardError:))]
119        #[unsafe(method_family = none)]
120        pub fn setStandardError(&self, standard_error: Option<&NSFileHandle>);
121
122        #[cfg(all(
123            feature = "NSArray",
124            feature = "NSError",
125            feature = "NSString",
126            feature = "block2"
127        ))]
128        /// # Safety
129        ///
130        /// `handler` must be a valid pointer or null.
131        #[unsafe(method(executeWithArguments:completionHandler:))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn executeWithArguments_completionHandler(
134            &self,
135            arguments: Option<&NSArray<NSString>>,
136            handler: NSUserUnixTaskCompletionHandler,
137        );
138    );
139}
140
141/// Methods declared on superclass `NSUserScriptTask`.
142impl NSUserUnixTask {
143    extern_methods!(
144        #[cfg(all(feature = "NSError", feature = "NSURL"))]
145        #[unsafe(method(initWithURL:error:_))]
146        #[unsafe(method_family = init)]
147        pub fn initWithURL_error(
148            this: Allocated<Self>,
149            url: &NSURL,
150        ) -> Result<Retained<Self>, Retained<NSError>>;
151    );
152}
153
154/// Methods declared on superclass `NSObject`.
155impl NSUserUnixTask {
156    extern_methods!(
157        #[unsafe(method(init))]
158        #[unsafe(method_family = init)]
159        pub fn init(this: Allocated<Self>) -> Retained<Self>;
160
161        #[unsafe(method(new))]
162        #[unsafe(method_family = new)]
163        pub fn new() -> Retained<Self>;
164    );
165}
166
167impl DefaultRetained for NSUserUnixTask {
168    #[inline]
169    fn default_retained() -> Retained<Self> {
170        Self::new()
171    }
172}
173
174/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsuserapplescripttaskcompletionhandler?language=objc)
175#[cfg(all(
176    feature = "NSAppleEventDescriptor",
177    feature = "NSError",
178    feature = "block2"
179))]
180pub type NSUserAppleScriptTaskCompletionHandler =
181    *mut block2::DynBlock<dyn Fn(*mut NSAppleEventDescriptor, *mut NSError)>;
182
183extern_class!(
184    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsuserapplescripttask?language=objc)
185    #[unsafe(super(NSUserScriptTask, NSObject))]
186    #[derive(Debug, PartialEq, Eq, Hash)]
187    pub struct NSUserAppleScriptTask;
188);
189
190extern_conformance!(
191    unsafe impl NSObjectProtocol for NSUserAppleScriptTask {}
192);
193
194impl NSUserAppleScriptTask {
195    extern_methods!(
196        #[cfg(all(
197            feature = "NSAppleEventDescriptor",
198            feature = "NSError",
199            feature = "block2"
200        ))]
201        /// # Safety
202        ///
203        /// `handler` must be a valid pointer or null.
204        #[unsafe(method(executeWithAppleEvent:completionHandler:))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn executeWithAppleEvent_completionHandler(
207            &self,
208            event: Option<&NSAppleEventDescriptor>,
209            handler: NSUserAppleScriptTaskCompletionHandler,
210        );
211    );
212}
213
214/// Methods declared on superclass `NSUserScriptTask`.
215impl NSUserAppleScriptTask {
216    extern_methods!(
217        #[cfg(all(feature = "NSError", feature = "NSURL"))]
218        #[unsafe(method(initWithURL:error:_))]
219        #[unsafe(method_family = init)]
220        pub fn initWithURL_error(
221            this: Allocated<Self>,
222            url: &NSURL,
223        ) -> Result<Retained<Self>, Retained<NSError>>;
224    );
225}
226
227/// Methods declared on superclass `NSObject`.
228impl NSUserAppleScriptTask {
229    extern_methods!(
230        #[unsafe(method(init))]
231        #[unsafe(method_family = init)]
232        pub fn init(this: Allocated<Self>) -> Retained<Self>;
233
234        #[unsafe(method(new))]
235        #[unsafe(method_family = new)]
236        pub fn new() -> Retained<Self>;
237    );
238}
239
240impl DefaultRetained for NSUserAppleScriptTask {
241    #[inline]
242    fn default_retained() -> Retained<Self> {
243        Self::new()
244    }
245}
246
247/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsuserautomatortaskcompletionhandler?language=objc)
248#[cfg(all(feature = "NSError", feature = "block2"))]
249pub type NSUserAutomatorTaskCompletionHandler =
250    *mut block2::DynBlock<dyn Fn(*mut AnyObject, *mut NSError)>;
251
252extern_class!(
253    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsuserautomatortask?language=objc)
254    #[unsafe(super(NSUserScriptTask, NSObject))]
255    #[derive(Debug, PartialEq, Eq, Hash)]
256    pub struct NSUserAutomatorTask;
257);
258
259extern_conformance!(
260    unsafe impl NSObjectProtocol for NSUserAutomatorTask {}
261);
262
263impl NSUserAutomatorTask {
264    extern_methods!(
265        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
266        #[unsafe(method(variables))]
267        #[unsafe(method_family = none)]
268        pub fn variables(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
269
270        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
271        /// Setter for [`variables`][Self::variables].
272        ///
273        /// This is [copied][crate::NSCopying::copy] when set.
274        ///
275        /// # Safety
276        ///
277        /// `variables` generic should be of the correct type.
278        #[unsafe(method(setVariables:))]
279        #[unsafe(method_family = none)]
280        pub unsafe fn setVariables(&self, variables: Option<&NSDictionary<NSString, AnyObject>>);
281
282        #[cfg(all(feature = "NSError", feature = "NSObject", feature = "block2"))]
283        /// # Safety
284        ///
285        /// - `input` should be of the correct type.
286        /// - `handler` must be a valid pointer or null.
287        #[unsafe(method(executeWithInput:completionHandler:))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn executeWithInput_completionHandler(
290            &self,
291            input: Option<&ProtocolObject<dyn NSSecureCoding>>,
292            handler: NSUserAutomatorTaskCompletionHandler,
293        );
294    );
295}
296
297/// Methods declared on superclass `NSUserScriptTask`.
298impl NSUserAutomatorTask {
299    extern_methods!(
300        #[cfg(all(feature = "NSError", feature = "NSURL"))]
301        #[unsafe(method(initWithURL:error:_))]
302        #[unsafe(method_family = init)]
303        pub fn initWithURL_error(
304            this: Allocated<Self>,
305            url: &NSURL,
306        ) -> Result<Retained<Self>, Retained<NSError>>;
307    );
308}
309
310/// Methods declared on superclass `NSObject`.
311impl NSUserAutomatorTask {
312    extern_methods!(
313        #[unsafe(method(init))]
314        #[unsafe(method_family = init)]
315        pub fn init(this: Allocated<Self>) -> Retained<Self>;
316
317        #[unsafe(method(new))]
318        #[unsafe(method_family = new)]
319        pub fn new() -> Retained<Self>;
320    );
321}
322
323impl DefaultRetained for NSUserAutomatorTask {
324    #[inline]
325    fn default_retained() -> Retained<Self> {
326        Self::new()
327    }
328}