objc2_foundation/generated/
NSConnection.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10 #[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 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 fn allConnections() -> Retained<NSArray<NSConnection>>;
34
35 #[deprecated]
36 #[unsafe(method(defaultConnection))]
37 #[unsafe(method_family = none)]
38 pub 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 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 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 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 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:))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn serviceConnectionWithName_rootObject_usingNameServer(
90 name: &NSString,
91 root: &AnyObject,
92 server: &NSPortNameServer,
93 ) -> Option<Retained<Self>>;
94
95 #[cfg(feature = "NSString")]
96 #[unsafe(method(serviceConnectionWithName:rootObject:))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn serviceConnectionWithName_rootObject(
102 name: &NSString,
103 root: &AnyObject,
104 ) -> Option<Retained<Self>>;
105
106 #[cfg(feature = "NSDate")]
107 #[deprecated = "Use NSXPCConnection instead"]
108 #[unsafe(method(requestTimeout))]
109 #[unsafe(method_family = none)]
110 pub fn requestTimeout(&self) -> NSTimeInterval;
111
112 #[cfg(feature = "NSDate")]
113 #[deprecated = "Use NSXPCConnection instead"]
115 #[unsafe(method(setRequestTimeout:))]
116 #[unsafe(method_family = none)]
117 pub fn setRequestTimeout(&self, request_timeout: NSTimeInterval);
118
119 #[cfg(feature = "NSDate")]
120 #[deprecated = "Use NSXPCConnection instead"]
121 #[unsafe(method(replyTimeout))]
122 #[unsafe(method_family = none)]
123 pub fn replyTimeout(&self) -> NSTimeInterval;
124
125 #[cfg(feature = "NSDate")]
126 #[deprecated = "Use NSXPCConnection instead"]
128 #[unsafe(method(setReplyTimeout:))]
129 #[unsafe(method_family = none)]
130 pub fn setReplyTimeout(&self, reply_timeout: NSTimeInterval);
131
132 #[deprecated = "Use NSXPCConnection instead"]
133 #[unsafe(method(rootObject))]
134 #[unsafe(method_family = none)]
135 pub fn rootObject(&self) -> Option<Retained<AnyObject>>;
136
137 #[deprecated = "Use NSXPCConnection instead"]
143 #[unsafe(method(setRootObject:))]
144 #[unsafe(method_family = none)]
145 pub unsafe fn setRootObject(&self, root_object: Option<&AnyObject>);
146
147 #[deprecated = "Use NSXPCConnection instead"]
151 #[unsafe(method(delegate))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn delegate(&self)
154 -> Option<Retained<ProtocolObject<dyn NSConnectionDelegate>>>;
155
156 #[deprecated = "Use NSXPCConnection instead"]
162 #[unsafe(method(setDelegate:))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn setDelegate(
165 &self,
166 delegate: Option<&ProtocolObject<dyn NSConnectionDelegate>>,
167 );
168
169 #[deprecated = "Use NSXPCConnection instead"]
170 #[unsafe(method(independentConversationQueueing))]
171 #[unsafe(method_family = none)]
172 pub fn independentConversationQueueing(&self) -> bool;
173
174 #[deprecated = "Use NSXPCConnection instead"]
176 #[unsafe(method(setIndependentConversationQueueing:))]
177 #[unsafe(method_family = none)]
178 pub fn setIndependentConversationQueueing(&self, independent_conversation_queueing: bool);
179
180 #[deprecated = "Use NSXPCConnection instead"]
181 #[unsafe(method(isValid))]
182 #[unsafe(method_family = none)]
183 pub fn isValid(&self) -> bool;
184
185 #[cfg(all(feature = "NSDistantObject", feature = "NSProxy"))]
186 #[deprecated = "Use NSXPCConnection instead"]
187 #[unsafe(method(rootProxy))]
188 #[unsafe(method_family = none)]
189 pub fn rootProxy(&self) -> Retained<NSDistantObject>;
190
191 #[deprecated = "Use NSXPCConnection instead"]
192 #[unsafe(method(invalidate))]
193 #[unsafe(method_family = none)]
194 pub fn invalidate(&self);
195
196 #[cfg(feature = "NSString")]
197 #[deprecated = "Use NSXPCConnection instead"]
198 #[unsafe(method(addRequestMode:))]
199 #[unsafe(method_family = none)]
200 pub fn addRequestMode(&self, rmode: &NSString);
201
202 #[cfg(feature = "NSString")]
203 #[deprecated = "Use NSXPCConnection instead"]
204 #[unsafe(method(removeRequestMode:))]
205 #[unsafe(method_family = none)]
206 pub fn removeRequestMode(&self, rmode: &NSString);
207
208 #[cfg(all(feature = "NSArray", feature = "NSString"))]
209 #[deprecated = "Use NSXPCConnection instead"]
210 #[unsafe(method(requestModes))]
211 #[unsafe(method_family = none)]
212 pub fn requestModes(&self) -> Retained<NSArray<NSString>>;
213
214 #[cfg(feature = "NSString")]
215 #[deprecated = "Use NSXPCConnection instead"]
216 #[unsafe(method(registerName:))]
217 #[unsafe(method_family = none)]
218 pub fn registerName(&self, name: Option<&NSString>) -> bool;
219
220 #[cfg(all(feature = "NSPortNameServer", feature = "NSString"))]
221 #[deprecated = "Use NSXPCConnection instead"]
222 #[unsafe(method(registerName:withNameServer:))]
223 #[unsafe(method_family = none)]
224 pub fn registerName_withNameServer(
225 &self,
226 name: Option<&NSString>,
227 server: &NSPortNameServer,
228 ) -> bool;
229
230 #[cfg(feature = "NSPort")]
231 #[deprecated = "Use NSXPCConnection instead"]
232 #[unsafe(method(connectionWithReceivePort:sendPort:))]
233 #[unsafe(method_family = none)]
234 pub fn connectionWithReceivePort_sendPort(
235 receive_port: Option<&NSPort>,
236 send_port: Option<&NSPort>,
237 ) -> Option<Retained<Self>>;
238
239 #[deprecated = "Use NSXPCConnection instead"]
240 #[unsafe(method(currentConversation))]
241 #[unsafe(method_family = none)]
242 pub fn currentConversation() -> Option<Retained<AnyObject>>;
243
244 #[cfg(feature = "NSPort")]
245 #[deprecated = "Use NSXPCConnection instead"]
246 #[unsafe(method(initWithReceivePort:sendPort:))]
247 #[unsafe(method_family = init)]
248 pub fn initWithReceivePort_sendPort(
249 this: Allocated<Self>,
250 receive_port: Option<&NSPort>,
251 send_port: Option<&NSPort>,
252 ) -> Option<Retained<Self>>;
253
254 #[cfg(feature = "NSPort")]
255 #[deprecated = "Use NSXPCConnection instead"]
256 #[unsafe(method(sendPort))]
257 #[unsafe(method_family = none)]
258 pub fn sendPort(&self) -> Retained<NSPort>;
259
260 #[cfg(feature = "NSPort")]
261 #[deprecated = "Use NSXPCConnection instead"]
262 #[unsafe(method(receivePort))]
263 #[unsafe(method_family = none)]
264 pub fn receivePort(&self) -> Retained<NSPort>;
265
266 #[deprecated = "Use NSXPCConnection instead"]
267 #[unsafe(method(enableMultipleThreads))]
268 #[unsafe(method_family = none)]
269 pub fn enableMultipleThreads(&self);
270
271 #[deprecated = "Use NSXPCConnection instead"]
272 #[unsafe(method(multipleThreadsEnabled))]
273 #[unsafe(method_family = none)]
274 pub fn multipleThreadsEnabled(&self) -> bool;
275
276 #[cfg(feature = "NSRunLoop")]
277 #[deprecated = "Use NSXPCConnection instead"]
281 #[unsafe(method(addRunLoop:))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn addRunLoop(&self, runloop: &NSRunLoop);
284
285 #[cfg(feature = "NSRunLoop")]
286 #[deprecated = "Use NSXPCConnection instead"]
290 #[unsafe(method(removeRunLoop:))]
291 #[unsafe(method_family = none)]
292 pub unsafe fn removeRunLoop(&self, runloop: &NSRunLoop);
293
294 #[deprecated = "Use NSXPCConnection instead"]
295 #[unsafe(method(runInNewThread))]
296 #[unsafe(method_family = none)]
297 pub fn runInNewThread(&self);
298
299 #[cfg(feature = "NSArray")]
300 #[deprecated = "Use NSXPCConnection instead"]
301 #[unsafe(method(remoteObjects))]
302 #[unsafe(method_family = none)]
303 pub fn remoteObjects(&self) -> Retained<NSArray>;
304
305 #[cfg(feature = "NSArray")]
306 #[deprecated = "Use NSXPCConnection instead"]
307 #[unsafe(method(localObjects))]
308 #[unsafe(method_family = none)]
309 pub fn localObjects(&self) -> Retained<NSArray>;
310
311 #[cfg(feature = "NSArray")]
312 #[unsafe(method(dispatchWithComponents:))]
316 #[unsafe(method_family = none)]
317 pub unsafe fn dispatchWithComponents(&self, components: &NSArray);
318 );
319}
320
321impl NSConnection {
323 extern_methods!(
324 #[unsafe(method(init))]
325 #[unsafe(method_family = init)]
326 pub fn init(this: Allocated<Self>) -> Retained<Self>;
327
328 #[unsafe(method(new))]
329 #[unsafe(method_family = new)]
330 pub fn new() -> Retained<Self>;
331 );
332}
333
334impl DefaultRetained for NSConnection {
335 #[inline]
336 fn default_retained() -> Retained<Self> {
337 Self::new()
338 }
339}
340
341extern "C" {
342 #[cfg(feature = "NSString")]
344 #[deprecated = "Use NSXPCConnection instead"]
345 pub static NSConnectionReplyMode: &'static NSString;
346}
347
348extern "C" {
349 #[cfg(feature = "NSString")]
351 #[deprecated = "Use NSXPCConnection instead"]
352 pub static NSConnectionDidDieNotification: &'static NSString;
353}
354
355extern_protocol!(
356 #[deprecated = "Use NSXPCConnection instead"]
358 pub unsafe trait NSConnectionDelegate: NSObjectProtocol {
359 #[deprecated = "Use NSXPCConnection instead"]
360 #[optional]
361 #[unsafe(method(makeNewConnection:sender:))]
362 #[unsafe(method_family = none)]
363 fn makeNewConnection_sender(&self, conn: &NSConnection, ancestor: &NSConnection) -> bool;
364
365 #[deprecated = "Use NSXPCConnection instead"]
366 #[optional]
367 #[unsafe(method(connection:shouldMakeNewConnection:))]
368 #[unsafe(method_family = none)]
369 fn connection_shouldMakeNewConnection(
370 &self,
371 ancestor: &NSConnection,
372 conn: &NSConnection,
373 ) -> bool;
374
375 #[cfg(all(feature = "NSArray", feature = "NSData"))]
376 #[deprecated = "Use NSXPCConnection instead"]
380 #[optional]
381 #[unsafe(method(authenticationDataForComponents:))]
382 #[unsafe(method_family = none)]
383 unsafe fn authenticationDataForComponents(&self, components: &NSArray) -> Retained<NSData>;
384
385 #[cfg(all(feature = "NSArray", feature = "NSData"))]
386 #[deprecated = "Use NSXPCConnection instead"]
390 #[optional]
391 #[unsafe(method(authenticateComponents:withData:))]
392 #[unsafe(method_family = none)]
393 unsafe fn authenticateComponents_withData(
394 &self,
395 components: &NSArray,
396 signature: &NSData,
397 ) -> bool;
398
399 #[deprecated = "Use NSXPCConnection instead"]
400 #[optional]
401 #[unsafe(method(createConversationForConnection:))]
402 #[unsafe(method_family = none)]
403 fn createConversationForConnection(&self, conn: &NSConnection) -> Retained<AnyObject>;
404
405 #[deprecated = "Use NSXPCConnection instead"]
406 #[optional]
407 #[unsafe(method(connection:handleRequest:))]
408 #[unsafe(method_family = none)]
409 fn connection_handleRequest(
410 &self,
411 connection: &NSConnection,
412 doreq: &NSDistantObjectRequest,
413 ) -> bool;
414 }
415);
416
417extern "C" {
418 #[cfg(feature = "NSString")]
420 #[deprecated = "Use NSXPCConnection instead"]
421 pub static NSFailedAuthenticationException: &'static NSString;
422}
423
424extern "C" {
425 #[cfg(feature = "NSString")]
427 #[deprecated = "Use NSXPCConnection instead"]
428 pub static NSConnectionDidInitializeNotification: &'static NSString;
429}
430
431extern_class!(
432 #[unsafe(super(NSObject))]
434 #[derive(Debug, PartialEq, Eq, Hash)]
435 #[deprecated = "Use NSXPCConnection instead"]
436 pub struct NSDistantObjectRequest;
437);
438
439extern_conformance!(
440 unsafe impl NSObjectProtocol for NSDistantObjectRequest {}
441);
442
443impl NSDistantObjectRequest {
444 extern_methods!(
445 #[cfg(feature = "NSInvocation")]
446 #[deprecated = "Use NSXPCConnection instead"]
447 #[unsafe(method(invocation))]
448 #[unsafe(method_family = none)]
449 pub unsafe fn invocation(&self) -> Retained<NSInvocation>;
450
451 #[deprecated = "Use NSXPCConnection instead"]
452 #[unsafe(method(connection))]
453 #[unsafe(method_family = none)]
454 pub fn connection(&self) -> Retained<NSConnection>;
455
456 #[deprecated = "Use NSXPCConnection instead"]
457 #[unsafe(method(conversation))]
458 #[unsafe(method_family = none)]
459 pub fn conversation(&self) -> Retained<AnyObject>;
460
461 #[cfg(feature = "NSException")]
462 #[deprecated = "Use NSXPCConnection instead"]
463 #[unsafe(method(replyWithException:))]
464 #[unsafe(method_family = none)]
465 pub fn replyWithException(&self, exception: Option<&NSException>);
466 );
467}
468
469impl NSDistantObjectRequest {
471 extern_methods!(
472 #[unsafe(method(init))]
473 #[unsafe(method_family = init)]
474 pub fn init(this: Allocated<Self>) -> Retained<Self>;
475
476 #[unsafe(method(new))]
477 #[unsafe(method_family = new)]
478 pub fn new() -> Retained<Self>;
479 );
480}
481
482impl DefaultRetained for NSDistantObjectRequest {
483 #[inline]
484 fn default_retained() -> Retained<Self> {
485 Self::new()
486 }
487}