objc2_multipeer_connectivity/generated/
MCNearbyServiceBrowser.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/multipeerconnectivity/mcnearbyservicebrowser?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct MCNearbyServiceBrowser;
15);
16
17extern_conformance!(
18    unsafe impl NSObjectProtocol for MCNearbyServiceBrowser {}
19);
20
21impl MCNearbyServiceBrowser {
22    extern_methods!(
23        #[cfg(feature = "MCPeerID")]
24        #[unsafe(method(initWithPeer:serviceType:))]
25        #[unsafe(method_family = init)]
26        pub unsafe fn initWithPeer_serviceType(
27            this: Allocated<Self>,
28            my_peer_id: &MCPeerID,
29            service_type: &NSString,
30        ) -> Retained<Self>;
31
32        #[unsafe(method(startBrowsingForPeers))]
33        #[unsafe(method_family = none)]
34        pub unsafe fn startBrowsingForPeers(&self);
35
36        #[unsafe(method(stopBrowsingForPeers))]
37        #[unsafe(method_family = none)]
38        pub unsafe fn stopBrowsingForPeers(&self);
39
40        #[cfg(all(feature = "MCPeerID", feature = "MCSession"))]
41        #[unsafe(method(invitePeer:toSession:withContext:timeout:))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn invitePeer_toSession_withContext_timeout(
44            &self,
45            peer_id: &MCPeerID,
46            session: &MCSession,
47            context: Option<&NSData>,
48            timeout: NSTimeInterval,
49        );
50
51        #[unsafe(method(delegate))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn delegate(
54            &self,
55        ) -> Option<Retained<ProtocolObject<dyn MCNearbyServiceBrowserDelegate>>>;
56
57        /// Setter for [`delegate`][Self::delegate].
58        ///
59        /// This is a [weak property][objc2::topics::weak_property].
60        #[unsafe(method(setDelegate:))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn setDelegate(
63            &self,
64            delegate: Option<&ProtocolObject<dyn MCNearbyServiceBrowserDelegate>>,
65        );
66
67        #[cfg(feature = "MCPeerID")]
68        #[unsafe(method(myPeerID))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn myPeerID(&self) -> Retained<MCPeerID>;
71
72        #[unsafe(method(serviceType))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn serviceType(&self) -> Retained<NSString>;
75    );
76}
77
78/// Methods declared on superclass `NSObject`.
79impl MCNearbyServiceBrowser {
80    extern_methods!(
81        #[unsafe(method(init))]
82        #[unsafe(method_family = init)]
83        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
84
85        #[unsafe(method(new))]
86        #[unsafe(method_family = new)]
87        pub unsafe fn new() -> Retained<Self>;
88    );
89}
90
91extern_protocol!(
92    /// [Apple's documentation](https://developer.apple.com/documentation/multipeerconnectivity/mcnearbyservicebrowserdelegate?language=objc)
93    pub unsafe trait MCNearbyServiceBrowserDelegate: NSObjectProtocol {
94        #[cfg(feature = "MCPeerID")]
95        #[unsafe(method(browser:foundPeer:withDiscoveryInfo:))]
96        #[unsafe(method_family = none)]
97        unsafe fn browser_foundPeer_withDiscoveryInfo(
98            &self,
99            browser: &MCNearbyServiceBrowser,
100            peer_id: &MCPeerID,
101            info: Option<&NSDictionary<NSString, NSString>>,
102        );
103
104        #[cfg(feature = "MCPeerID")]
105        #[unsafe(method(browser:lostPeer:))]
106        #[unsafe(method_family = none)]
107        unsafe fn browser_lostPeer(&self, browser: &MCNearbyServiceBrowser, peer_id: &MCPeerID);
108
109        #[optional]
110        #[unsafe(method(browser:didNotStartBrowsingForPeers:))]
111        #[unsafe(method_family = none)]
112        unsafe fn browser_didNotStartBrowsingForPeers(
113            &self,
114            browser: &MCNearbyServiceBrowser,
115            error: &NSError,
116        );
117    }
118);