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