objc2_map_kit/generated/
MKLocalSearchCompleter.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
10/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mksearchcompletionfiltertype?language=objc)
11// NS_ENUM
12#[deprecated = "Use MKLocalSearchCompleterResultType"]
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct MKSearchCompletionFilterType(pub NSInteger);
16impl MKSearchCompletionFilterType {
17    #[doc(alias = "MKSearchCompletionFilterTypeLocationsAndQueries")]
18    #[deprecated = "Use MKLocalSearchCompleterResultType"]
19    pub const LocationsAndQueries: Self = Self(0);
20    #[doc(alias = "MKSearchCompletionFilterTypeLocationsOnly")]
21    #[deprecated = "Use MKLocalSearchCompleterResultType"]
22    pub const LocationsOnly: Self = Self(1);
23}
24
25unsafe impl Encode for MKSearchCompletionFilterType {
26    const ENCODING: Encoding = NSInteger::ENCODING;
27}
28
29unsafe impl RefEncode for MKSearchCompletionFilterType {
30    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
31}
32
33/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mklocalsearchcompleterresulttype?language=objc)
34// NS_OPTIONS
35#[repr(transparent)]
36#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
37pub struct MKLocalSearchCompleterResultType(pub NSUInteger);
38bitflags::bitflags! {
39    impl MKLocalSearchCompleterResultType: NSUInteger {
40        #[doc(alias = "MKLocalSearchCompleterResultTypeAddress")]
41        const Address = 1<<0;
42        #[doc(alias = "MKLocalSearchCompleterResultTypePointOfInterest")]
43        const PointOfInterest = 1<<1;
44        #[doc(alias = "MKLocalSearchCompleterResultTypeQuery")]
45        const Query = 1<<2;
46        #[doc(alias = "MKLocalSearchCompleterResultTypePhysicalFeature")]
47        const PhysicalFeature = 1<<3;
48    }
49}
50
51unsafe impl Encode for MKLocalSearchCompleterResultType {
52    const ENCODING: Encoding = NSUInteger::ENCODING;
53}
54
55unsafe impl RefEncode for MKLocalSearchCompleterResultType {
56    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
57}
58
59extern_class!(
60    /// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mklocalsearchcompleter?language=objc)
61    #[unsafe(super(NSObject))]
62    #[derive(Debug, PartialEq, Eq, Hash)]
63    pub struct MKLocalSearchCompleter;
64);
65
66extern_conformance!(
67    unsafe impl NSObjectProtocol for MKLocalSearchCompleter {}
68);
69
70impl MKLocalSearchCompleter {
71    extern_methods!(
72        #[unsafe(method(queryFragment))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn queryFragment(&self) -> Retained<NSString>;
75
76        /// Setter for [`queryFragment`][Self::queryFragment].
77        #[unsafe(method(setQueryFragment:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn setQueryFragment(&self, query_fragment: &NSString);
80
81        #[cfg(all(feature = "MKGeometry", feature = "objc2-core-location"))]
82        #[unsafe(method(region))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn region(&self) -> MKCoordinateRegion;
85
86        #[cfg(all(feature = "MKGeometry", feature = "objc2-core-location"))]
87        /// Setter for [`region`][Self::region].
88        #[unsafe(method(setRegion:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn setRegion(&self, region: MKCoordinateRegion);
91
92        #[cfg(feature = "MKTypes")]
93        #[unsafe(method(regionPriority))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn regionPriority(&self) -> MKLocalSearchRegionPriority;
96
97        #[cfg(feature = "MKTypes")]
98        /// Setter for [`regionPriority`][Self::regionPriority].
99        #[unsafe(method(setRegionPriority:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn setRegionPriority(&self, region_priority: MKLocalSearchRegionPriority);
102
103        #[deprecated = "Use resultTypes"]
104        #[unsafe(method(filterType))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn filterType(&self) -> MKSearchCompletionFilterType;
107
108        /// Setter for [`filterType`][Self::filterType].
109        #[deprecated = "Use resultTypes"]
110        #[unsafe(method(setFilterType:))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn setFilterType(&self, filter_type: MKSearchCompletionFilterType);
113
114        #[unsafe(method(resultTypes))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn resultTypes(&self) -> MKLocalSearchCompleterResultType;
117
118        /// Setter for [`resultTypes`][Self::resultTypes].
119        #[unsafe(method(setResultTypes:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setResultTypes(&self, result_types: MKLocalSearchCompleterResultType);
122
123        #[cfg(feature = "MKPointOfInterestFilter")]
124        #[unsafe(method(pointOfInterestFilter))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn pointOfInterestFilter(&self) -> Option<Retained<MKPointOfInterestFilter>>;
127
128        #[cfg(feature = "MKPointOfInterestFilter")]
129        /// Setter for [`pointOfInterestFilter`][Self::pointOfInterestFilter].
130        #[unsafe(method(setPointOfInterestFilter:))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn setPointOfInterestFilter(
133            &self,
134            point_of_interest_filter: Option<&MKPointOfInterestFilter>,
135        );
136
137        #[cfg(feature = "MKAddressFilter")]
138        #[unsafe(method(addressFilter))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn addressFilter(&self) -> Option<Retained<MKAddressFilter>>;
141
142        #[cfg(feature = "MKAddressFilter")]
143        /// Setter for [`addressFilter`][Self::addressFilter].
144        #[unsafe(method(setAddressFilter:))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn setAddressFilter(&self, address_filter: Option<&MKAddressFilter>);
147
148        #[unsafe(method(delegate))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn delegate(
151            &self,
152        ) -> Option<Retained<ProtocolObject<dyn MKLocalSearchCompleterDelegate>>>;
153
154        /// This is a [weak property][objc2::topics::weak_property].
155        /// Setter for [`delegate`][Self::delegate].
156        #[unsafe(method(setDelegate:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn setDelegate(
159            &self,
160            delegate: Option<&ProtocolObject<dyn MKLocalSearchCompleterDelegate>>,
161        );
162
163        #[unsafe(method(results))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn results(&self) -> Retained<NSArray<MKLocalSearchCompletion>>;
166
167        #[unsafe(method(isSearching))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn isSearching(&self) -> bool;
170
171        #[unsafe(method(cancel))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn cancel(&self);
174    );
175}
176
177/// Methods declared on superclass `NSObject`.
178impl MKLocalSearchCompleter {
179    extern_methods!(
180        #[unsafe(method(init))]
181        #[unsafe(method_family = init)]
182        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
183
184        #[unsafe(method(new))]
185        #[unsafe(method_family = new)]
186        pub unsafe fn new() -> Retained<Self>;
187    );
188}
189
190extern_protocol!(
191    /// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mklocalsearchcompleterdelegate?language=objc)
192    pub unsafe trait MKLocalSearchCompleterDelegate: NSObjectProtocol {
193        #[optional]
194        #[unsafe(method(completerDidUpdateResults:))]
195        #[unsafe(method_family = none)]
196        unsafe fn completerDidUpdateResults(&self, completer: &MKLocalSearchCompleter);
197
198        #[optional]
199        #[unsafe(method(completer:didFailWithError:))]
200        #[unsafe(method_family = none)]
201        unsafe fn completer_didFailWithError(
202            &self,
203            completer: &MKLocalSearchCompleter,
204            error: &NSError,
205        );
206    }
207);
208
209extern_class!(
210    /// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mklocalsearchcompletion?language=objc)
211    #[unsafe(super(NSObject))]
212    #[derive(Debug, PartialEq, Eq, Hash)]
213    pub struct MKLocalSearchCompletion;
214);
215
216extern_conformance!(
217    unsafe impl NSObjectProtocol for MKLocalSearchCompletion {}
218);
219
220impl MKLocalSearchCompletion {
221    extern_methods!(
222        #[unsafe(method(title))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn title(&self) -> Retained<NSString>;
225
226        #[unsafe(method(titleHighlightRanges))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn titleHighlightRanges(&self) -> Retained<NSArray<NSValue>>;
229
230        #[unsafe(method(subtitle))]
231        #[unsafe(method_family = none)]
232        pub unsafe fn subtitle(&self) -> Retained<NSString>;
233
234        #[unsafe(method(subtitleHighlightRanges))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn subtitleHighlightRanges(&self) -> Retained<NSArray<NSValue>>;
237    );
238}
239
240/// Methods declared on superclass `NSObject`.
241impl MKLocalSearchCompletion {
242    extern_methods!(
243        #[unsafe(method(init))]
244        #[unsafe(method_family = init)]
245        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
246
247        #[unsafe(method(new))]
248        #[unsafe(method_family = new)]
249        pub unsafe fn new() -> Retained<Self>;
250    );
251}
252
253#[cfg(feature = "MKLocalSearchRequest")]
254impl MKLocalSearchRequest {
255    extern_methods!(
256        #[unsafe(method(initWithCompletion:))]
257        #[unsafe(method_family = init)]
258        pub unsafe fn initWithCompletion(
259            this: Allocated<Self>,
260            completion: &MKLocalSearchCompletion,
261        ) -> Retained<Self>;
262    );
263}