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        ///
78        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
79        #[unsafe(method(setQueryFragment:))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn setQueryFragment(&self, query_fragment: &NSString);
82
83        #[cfg(all(feature = "MKGeometry", feature = "objc2-core-location"))]
84        #[unsafe(method(region))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn region(&self) -> MKCoordinateRegion;
87
88        #[cfg(all(feature = "MKGeometry", feature = "objc2-core-location"))]
89        /// Setter for [`region`][Self::region].
90        #[unsafe(method(setRegion:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn setRegion(&self, region: MKCoordinateRegion);
93
94        #[cfg(feature = "MKTypes")]
95        #[unsafe(method(regionPriority))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn regionPriority(&self) -> MKLocalSearchRegionPriority;
98
99        #[cfg(feature = "MKTypes")]
100        /// Setter for [`regionPriority`][Self::regionPriority].
101        #[unsafe(method(setRegionPriority:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn setRegionPriority(&self, region_priority: MKLocalSearchRegionPriority);
104
105        #[deprecated = "Use resultTypes"]
106        #[unsafe(method(filterType))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn filterType(&self) -> MKSearchCompletionFilterType;
109
110        /// Setter for [`filterType`][Self::filterType].
111        #[deprecated = "Use resultTypes"]
112        #[unsafe(method(setFilterType:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn setFilterType(&self, filter_type: MKSearchCompletionFilterType);
115
116        #[unsafe(method(resultTypes))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn resultTypes(&self) -> MKLocalSearchCompleterResultType;
119
120        /// Setter for [`resultTypes`][Self::resultTypes].
121        #[unsafe(method(setResultTypes:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn setResultTypes(&self, result_types: MKLocalSearchCompleterResultType);
124
125        #[cfg(feature = "MKPointOfInterestFilter")]
126        #[unsafe(method(pointOfInterestFilter))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn pointOfInterestFilter(&self) -> Option<Retained<MKPointOfInterestFilter>>;
129
130        #[cfg(feature = "MKPointOfInterestFilter")]
131        /// Setter for [`pointOfInterestFilter`][Self::pointOfInterestFilter].
132        ///
133        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
134        #[unsafe(method(setPointOfInterestFilter:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn setPointOfInterestFilter(
137            &self,
138            point_of_interest_filter: Option<&MKPointOfInterestFilter>,
139        );
140
141        #[cfg(feature = "MKAddressFilter")]
142        #[unsafe(method(addressFilter))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn addressFilter(&self) -> Option<Retained<MKAddressFilter>>;
145
146        #[cfg(feature = "MKAddressFilter")]
147        /// Setter for [`addressFilter`][Self::addressFilter].
148        ///
149        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
150        #[unsafe(method(setAddressFilter:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn setAddressFilter(&self, address_filter: Option<&MKAddressFilter>);
153
154        #[unsafe(method(delegate))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn delegate(
157            &self,
158        ) -> Option<Retained<ProtocolObject<dyn MKLocalSearchCompleterDelegate>>>;
159
160        /// Setter for [`delegate`][Self::delegate].
161        ///
162        /// This is a [weak property][objc2::topics::weak_property].
163        #[unsafe(method(setDelegate:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn setDelegate(
166            &self,
167            delegate: Option<&ProtocolObject<dyn MKLocalSearchCompleterDelegate>>,
168        );
169
170        #[unsafe(method(results))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn results(&self) -> Retained<NSArray<MKLocalSearchCompletion>>;
173
174        #[unsafe(method(isSearching))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn isSearching(&self) -> bool;
177
178        #[unsafe(method(cancel))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn cancel(&self);
181    );
182}
183
184/// Methods declared on superclass `NSObject`.
185impl MKLocalSearchCompleter {
186    extern_methods!(
187        #[unsafe(method(init))]
188        #[unsafe(method_family = init)]
189        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
190
191        #[unsafe(method(new))]
192        #[unsafe(method_family = new)]
193        pub unsafe fn new() -> Retained<Self>;
194    );
195}
196
197extern_protocol!(
198    /// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mklocalsearchcompleterdelegate?language=objc)
199    pub unsafe trait MKLocalSearchCompleterDelegate: NSObjectProtocol {
200        #[optional]
201        #[unsafe(method(completerDidUpdateResults:))]
202        #[unsafe(method_family = none)]
203        unsafe fn completerDidUpdateResults(&self, completer: &MKLocalSearchCompleter);
204
205        #[optional]
206        #[unsafe(method(completer:didFailWithError:))]
207        #[unsafe(method_family = none)]
208        unsafe fn completer_didFailWithError(
209            &self,
210            completer: &MKLocalSearchCompleter,
211            error: &NSError,
212        );
213    }
214);
215
216extern_class!(
217    /// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mklocalsearchcompletion?language=objc)
218    #[unsafe(super(NSObject))]
219    #[derive(Debug, PartialEq, Eq, Hash)]
220    pub struct MKLocalSearchCompletion;
221);
222
223extern_conformance!(
224    unsafe impl NSObjectProtocol for MKLocalSearchCompletion {}
225);
226
227impl MKLocalSearchCompletion {
228    extern_methods!(
229        #[unsafe(method(title))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn title(&self) -> Retained<NSString>;
232
233        #[unsafe(method(titleHighlightRanges))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn titleHighlightRanges(&self) -> Retained<NSArray<NSValue>>;
236
237        #[unsafe(method(subtitle))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn subtitle(&self) -> Retained<NSString>;
240
241        #[unsafe(method(subtitleHighlightRanges))]
242        #[unsafe(method_family = none)]
243        pub unsafe fn subtitleHighlightRanges(&self) -> Retained<NSArray<NSValue>>;
244    );
245}
246
247/// Methods declared on superclass `NSObject`.
248impl MKLocalSearchCompletion {
249    extern_methods!(
250        #[unsafe(method(init))]
251        #[unsafe(method_family = init)]
252        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
253
254        #[unsafe(method(new))]
255        #[unsafe(method_family = new)]
256        pub unsafe fn new() -> Retained<Self>;
257    );
258}
259
260#[cfg(feature = "MKLocalSearchRequest")]
261impl MKLocalSearchRequest {
262    extern_methods!(
263        #[unsafe(method(initWithCompletion:))]
264        #[unsafe(method_family = init)]
265        pub unsafe fn initWithCompletion(
266            this: Allocated<Self>,
267            completion: &MKLocalSearchCompletion,
268        ) -> Retained<Self>;
269    );
270}