objc2_foundation/generated/
NSConnection.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
9extern_class!(
10    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsconnection?language=objc)
11    #[unsafe(super(NSObject))]
12    #[derive(Debug, PartialEq, Eq, Hash)]
13    #[deprecated = "Use NSXPCConnection instead"]
14    pub struct NSConnection;
15);
16
17extern_conformance!(
18    unsafe impl NSObjectProtocol for NSConnection {}
19);
20
21impl NSConnection {
22    extern_methods!(
23        #[cfg(all(feature = "NSDictionary", feature = "NSString", feature = "NSValue"))]
24        #[deprecated = "Use NSXPCConnection instead"]
25        #[unsafe(method(statistics))]
26        #[unsafe(method_family = none)]
27        pub unsafe fn statistics(&self) -> Retained<NSDictionary<NSString, NSNumber>>;
28
29        #[cfg(feature = "NSArray")]
30        #[deprecated = "Use NSXPCConnection instead"]
31        #[unsafe(method(allConnections))]
32        #[unsafe(method_family = none)]
33        pub unsafe fn allConnections() -> Retained<NSArray<NSConnection>>;
34
35        #[deprecated]
36        #[unsafe(method(defaultConnection))]
37        #[unsafe(method_family = none)]
38        pub unsafe fn defaultConnection() -> Retained<NSConnection>;
39
40        #[cfg(feature = "NSString")]
41        #[deprecated = "Use NSXPCConnection instead"]
42        #[unsafe(method(connectionWithRegisteredName:host:))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn connectionWithRegisteredName_host(
45            name: &NSString,
46            host_name: Option<&NSString>,
47        ) -> Option<Retained<Self>>;
48
49        #[cfg(all(feature = "NSPortNameServer", feature = "NSString"))]
50        #[deprecated = "Use NSXPCConnection instead"]
51        #[unsafe(method(connectionWithRegisteredName:host:usingNameServer:))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn connectionWithRegisteredName_host_usingNameServer(
54            name: &NSString,
55            host_name: Option<&NSString>,
56            server: &NSPortNameServer,
57        ) -> Option<Retained<Self>>;
58
59        #[cfg(all(feature = "NSDistantObject", feature = "NSProxy", feature = "NSString"))]
60        #[deprecated = "Use NSXPCConnection instead"]
61        #[unsafe(method(rootProxyForConnectionWithRegisteredName:host:))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn rootProxyForConnectionWithRegisteredName_host(
64            name: &NSString,
65            host_name: Option<&NSString>,
66        ) -> Option<Retained<NSDistantObject>>;
67
68        #[cfg(all(
69            feature = "NSDistantObject",
70            feature = "NSPortNameServer",
71            feature = "NSProxy",
72            feature = "NSString"
73        ))]
74        #[deprecated = "Use NSXPCConnection instead"]
75        #[unsafe(method(rootProxyForConnectionWithRegisteredName:host:usingNameServer:))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn rootProxyForConnectionWithRegisteredName_host_usingNameServer(
78            name: &NSString,
79            host_name: Option<&NSString>,
80            server: &NSPortNameServer,
81        ) -> Option<Retained<NSDistantObject>>;
82
83        #[cfg(all(feature = "NSPortNameServer", feature = "NSString"))]
84        #[unsafe(method(serviceConnectionWithName:rootObject:usingNameServer:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn serviceConnectionWithName_rootObject_usingNameServer(
87            name: &NSString,
88            root: &AnyObject,
89            server: &NSPortNameServer,
90        ) -> Option<Retained<Self>>;
91
92        #[cfg(feature = "NSString")]
93        #[unsafe(method(serviceConnectionWithName:rootObject:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn serviceConnectionWithName_rootObject(
96            name: &NSString,
97            root: &AnyObject,
98        ) -> Option<Retained<Self>>;
99
100        #[cfg(feature = "NSDate")]
101        #[deprecated = "Use NSXPCConnection instead"]
102        #[unsafe(method(requestTimeout))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn requestTimeout(&self) -> NSTimeInterval;
105
106        #[cfg(feature = "NSDate")]
107        /// Setter for [`requestTimeout`][Self::requestTimeout].
108        #[deprecated = "Use NSXPCConnection instead"]
109        #[unsafe(method(setRequestTimeout:))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn setRequestTimeout(&self, request_timeout: NSTimeInterval);
112
113        #[cfg(feature = "NSDate")]
114        #[deprecated = "Use NSXPCConnection instead"]
115        #[unsafe(method(replyTimeout))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn replyTimeout(&self) -> NSTimeInterval;
118
119        #[cfg(feature = "NSDate")]
120        /// Setter for [`replyTimeout`][Self::replyTimeout].
121        #[deprecated = "Use NSXPCConnection instead"]
122        #[unsafe(method(setReplyTimeout:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn setReplyTimeout(&self, reply_timeout: NSTimeInterval);
125
126        #[deprecated = "Use NSXPCConnection instead"]
127        #[unsafe(method(rootObject))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn rootObject(&self) -> Option<Retained<AnyObject>>;
130
131        /// Setter for [`rootObject`][Self::rootObject].
132        #[deprecated = "Use NSXPCConnection instead"]
133        #[unsafe(method(setRootObject:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn setRootObject(&self, root_object: Option<&AnyObject>);
136
137        #[deprecated = "Use NSXPCConnection instead"]
138        #[unsafe(method(delegate))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn delegate(&self)
141            -> Option<Retained<ProtocolObject<dyn NSConnectionDelegate>>>;
142
143        /// Setter for [`delegate`][Self::delegate].
144        #[deprecated = "Use NSXPCConnection instead"]
145        #[unsafe(method(setDelegate:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn setDelegate(
148            &self,
149            delegate: Option<&ProtocolObject<dyn NSConnectionDelegate>>,
150        );
151
152        #[deprecated = "Use NSXPCConnection instead"]
153        #[unsafe(method(independentConversationQueueing))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn independentConversationQueueing(&self) -> bool;
156
157        /// Setter for [`independentConversationQueueing`][Self::independentConversationQueueing].
158        #[deprecated = "Use NSXPCConnection instead"]
159        #[unsafe(method(setIndependentConversationQueueing:))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn setIndependentConversationQueueing(
162            &self,
163            independent_conversation_queueing: bool,
164        );
165
166        #[deprecated = "Use NSXPCConnection instead"]
167        #[unsafe(method(isValid))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn isValid(&self) -> bool;
170
171        #[cfg(all(feature = "NSDistantObject", feature = "NSProxy"))]
172        #[deprecated = "Use NSXPCConnection instead"]
173        #[unsafe(method(rootProxy))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn rootProxy(&self) -> Retained<NSDistantObject>;
176
177        #[deprecated = "Use NSXPCConnection instead"]
178        #[unsafe(method(invalidate))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn invalidate(&self);
181
182        #[cfg(feature = "NSString")]
183        #[deprecated = "Use NSXPCConnection instead"]
184        #[unsafe(method(addRequestMode:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn addRequestMode(&self, rmode: &NSString);
187
188        #[cfg(feature = "NSString")]
189        #[deprecated = "Use NSXPCConnection instead"]
190        #[unsafe(method(removeRequestMode:))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn removeRequestMode(&self, rmode: &NSString);
193
194        #[cfg(all(feature = "NSArray", feature = "NSString"))]
195        #[deprecated = "Use NSXPCConnection instead"]
196        #[unsafe(method(requestModes))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn requestModes(&self) -> Retained<NSArray<NSString>>;
199
200        #[cfg(feature = "NSString")]
201        #[deprecated = "Use NSXPCConnection instead"]
202        #[unsafe(method(registerName:))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn registerName(&self, name: Option<&NSString>) -> bool;
205
206        #[cfg(all(feature = "NSPortNameServer", feature = "NSString"))]
207        #[deprecated = "Use NSXPCConnection instead"]
208        #[unsafe(method(registerName:withNameServer:))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn registerName_withNameServer(
211            &self,
212            name: Option<&NSString>,
213            server: &NSPortNameServer,
214        ) -> bool;
215
216        #[cfg(feature = "NSPort")]
217        #[deprecated = "Use NSXPCConnection instead"]
218        #[unsafe(method(connectionWithReceivePort:sendPort:))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn connectionWithReceivePort_sendPort(
221            receive_port: Option<&NSPort>,
222            send_port: Option<&NSPort>,
223        ) -> Option<Retained<Self>>;
224
225        #[deprecated = "Use NSXPCConnection instead"]
226        #[unsafe(method(currentConversation))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn currentConversation() -> Option<Retained<AnyObject>>;
229
230        #[cfg(feature = "NSPort")]
231        #[deprecated = "Use NSXPCConnection instead"]
232        #[unsafe(method(initWithReceivePort:sendPort:))]
233        #[unsafe(method_family = init)]
234        pub unsafe fn initWithReceivePort_sendPort(
235            this: Allocated<Self>,
236            receive_port: Option<&NSPort>,
237            send_port: Option<&NSPort>,
238        ) -> Option<Retained<Self>>;
239
240        #[cfg(feature = "NSPort")]
241        #[deprecated = "Use NSXPCConnection instead"]
242        #[unsafe(method(sendPort))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn sendPort(&self) -> Retained<NSPort>;
245
246        #[cfg(feature = "NSPort")]
247        #[deprecated = "Use NSXPCConnection instead"]
248        #[unsafe(method(receivePort))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn receivePort(&self) -> Retained<NSPort>;
251
252        #[deprecated = "Use NSXPCConnection instead"]
253        #[unsafe(method(enableMultipleThreads))]
254        #[unsafe(method_family = none)]
255        pub unsafe fn enableMultipleThreads(&self);
256
257        #[deprecated = "Use NSXPCConnection instead"]
258        #[unsafe(method(multipleThreadsEnabled))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn multipleThreadsEnabled(&self) -> bool;
261
262        #[cfg(feature = "NSRunLoop")]
263        #[deprecated = "Use NSXPCConnection instead"]
264        #[unsafe(method(addRunLoop:))]
265        #[unsafe(method_family = none)]
266        pub unsafe fn addRunLoop(&self, runloop: &NSRunLoop);
267
268        #[cfg(feature = "NSRunLoop")]
269        #[deprecated = "Use NSXPCConnection instead"]
270        #[unsafe(method(removeRunLoop:))]
271        #[unsafe(method_family = none)]
272        pub unsafe fn removeRunLoop(&self, runloop: &NSRunLoop);
273
274        #[deprecated = "Use NSXPCConnection instead"]
275        #[unsafe(method(runInNewThread))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn runInNewThread(&self);
278
279        #[cfg(feature = "NSArray")]
280        #[deprecated = "Use NSXPCConnection instead"]
281        #[unsafe(method(remoteObjects))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn remoteObjects(&self) -> Retained<NSArray>;
284
285        #[cfg(feature = "NSArray")]
286        #[deprecated = "Use NSXPCConnection instead"]
287        #[unsafe(method(localObjects))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn localObjects(&self) -> Retained<NSArray>;
290
291        #[cfg(feature = "NSArray")]
292        #[unsafe(method(dispatchWithComponents:))]
293        #[unsafe(method_family = none)]
294        pub unsafe fn dispatchWithComponents(&self, components: &NSArray);
295    );
296}
297
298/// Methods declared on superclass `NSObject`.
299impl NSConnection {
300    extern_methods!(
301        #[unsafe(method(init))]
302        #[unsafe(method_family = init)]
303        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
304
305        #[unsafe(method(new))]
306        #[unsafe(method_family = new)]
307        pub unsafe fn new() -> Retained<Self>;
308    );
309}
310
311extern "C" {
312    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsconnectionreplymode?language=objc)
313    #[cfg(feature = "NSString")]
314    pub static NSConnectionReplyMode: &'static NSString;
315}
316
317extern "C" {
318    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsconnectiondiddienotification?language=objc)
319    #[cfg(feature = "NSString")]
320    pub static NSConnectionDidDieNotification: &'static NSString;
321}
322
323extern_protocol!(
324    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsconnectiondelegate?language=objc)
325    #[deprecated = "Use NSXPCConnection instead"]
326    pub unsafe trait NSConnectionDelegate: NSObjectProtocol {
327        #[deprecated = "Use NSXPCConnection instead"]
328        #[optional]
329        #[unsafe(method(makeNewConnection:sender:))]
330        #[unsafe(method_family = none)]
331        unsafe fn makeNewConnection_sender(
332            &self,
333            conn: &NSConnection,
334            ancestor: &NSConnection,
335        ) -> bool;
336
337        #[deprecated = "Use NSXPCConnection instead"]
338        #[optional]
339        #[unsafe(method(connection:shouldMakeNewConnection:))]
340        #[unsafe(method_family = none)]
341        unsafe fn connection_shouldMakeNewConnection(
342            &self,
343            ancestor: &NSConnection,
344            conn: &NSConnection,
345        ) -> bool;
346
347        #[cfg(all(feature = "NSArray", feature = "NSData"))]
348        #[deprecated = "Use NSXPCConnection instead"]
349        #[optional]
350        #[unsafe(method(authenticationDataForComponents:))]
351        #[unsafe(method_family = none)]
352        unsafe fn authenticationDataForComponents(&self, components: &NSArray) -> Retained<NSData>;
353
354        #[cfg(all(feature = "NSArray", feature = "NSData"))]
355        #[deprecated = "Use NSXPCConnection instead"]
356        #[optional]
357        #[unsafe(method(authenticateComponents:withData:))]
358        #[unsafe(method_family = none)]
359        unsafe fn authenticateComponents_withData(
360            &self,
361            components: &NSArray,
362            signature: &NSData,
363        ) -> bool;
364
365        #[deprecated = "Use NSXPCConnection instead"]
366        #[optional]
367        #[unsafe(method(createConversationForConnection:))]
368        #[unsafe(method_family = none)]
369        unsafe fn createConversationForConnection(
370            &self,
371            conn: &NSConnection,
372        ) -> Retained<AnyObject>;
373
374        #[deprecated = "Use NSXPCConnection instead"]
375        #[optional]
376        #[unsafe(method(connection:handleRequest:))]
377        #[unsafe(method_family = none)]
378        unsafe fn connection_handleRequest(
379            &self,
380            connection: &NSConnection,
381            doreq: &NSDistantObjectRequest,
382        ) -> bool;
383    }
384);
385
386extern "C" {
387    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfailedauthenticationexception?language=objc)
388    #[cfg(feature = "NSString")]
389    pub static NSFailedAuthenticationException: &'static NSString;
390}
391
392extern "C" {
393    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsconnectiondidinitializenotification?language=objc)
394    #[cfg(feature = "NSString")]
395    pub static NSConnectionDidInitializeNotification: &'static NSString;
396}
397
398extern_class!(
399    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsdistantobjectrequest?language=objc)
400    #[unsafe(super(NSObject))]
401    #[derive(Debug, PartialEq, Eq, Hash)]
402    #[deprecated = "Use NSXPCConnection instead"]
403    pub struct NSDistantObjectRequest;
404);
405
406extern_conformance!(
407    unsafe impl NSObjectProtocol for NSDistantObjectRequest {}
408);
409
410impl NSDistantObjectRequest {
411    extern_methods!(
412        #[cfg(feature = "NSInvocation")]
413        #[deprecated = "Use NSXPCConnection instead"]
414        #[unsafe(method(invocation))]
415        #[unsafe(method_family = none)]
416        pub unsafe fn invocation(&self) -> Retained<NSInvocation>;
417
418        #[deprecated = "Use NSXPCConnection instead"]
419        #[unsafe(method(connection))]
420        #[unsafe(method_family = none)]
421        pub unsafe fn connection(&self) -> Retained<NSConnection>;
422
423        #[deprecated = "Use NSXPCConnection instead"]
424        #[unsafe(method(conversation))]
425        #[unsafe(method_family = none)]
426        pub unsafe fn conversation(&self) -> Retained<AnyObject>;
427
428        #[cfg(feature = "NSException")]
429        #[deprecated = "Use NSXPCConnection instead"]
430        #[unsafe(method(replyWithException:))]
431        #[unsafe(method_family = none)]
432        pub unsafe fn replyWithException(&self, exception: Option<&NSException>);
433    );
434}
435
436/// Methods declared on superclass `NSObject`.
437impl NSDistantObjectRequest {
438    extern_methods!(
439        #[unsafe(method(init))]
440        #[unsafe(method_family = init)]
441        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
442
443        #[unsafe(method(new))]
444        #[unsafe(method_family = new)]
445        pub unsafe fn new() -> Retained<Self>;
446    );
447}