objc2_core_spotlight/generated/
CSSearchableIndex.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7#[cfg(feature = "objc2-uniform-type-identifiers")]
8use objc2_uniform_type_identifiers::*;
9
10use crate::*;
11
12extern "C" {
13 pub static CSIndexErrorDomain: &'static NSString;
15}
16
17#[repr(transparent)]
20#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
21pub struct CSIndexErrorCode(pub NSInteger);
22impl CSIndexErrorCode {
23 #[doc(alias = "CSIndexErrorCodeUnknownError")]
24 pub const UnknownError: Self = Self(-1);
25 #[doc(alias = "CSIndexErrorCodeIndexUnavailableError")]
26 pub const IndexUnavailableError: Self = Self(-1000);
27 #[doc(alias = "CSIndexErrorCodeInvalidItemError")]
28 pub const InvalidItemError: Self = Self(-1001);
29 #[doc(alias = "CSIndexErrorCodeInvalidClientStateError")]
30 pub const InvalidClientStateError: Self = Self(-1002);
31 #[doc(alias = "CSIndexErrorCodeRemoteConnectionError")]
32 pub const RemoteConnectionError: Self = Self(-1003);
33 #[doc(alias = "CSIndexErrorCodeQuotaExceeded")]
34 pub const QuotaExceeded: Self = Self(-1004);
35 #[doc(alias = "CSIndexErrorCodeIndexingUnsupported")]
36 pub const IndexingUnsupported: Self = Self(-1005);
37 #[doc(alias = "CSIndexErrorCodeMismatchedClientState")]
38 pub const MismatchedClientState: Self = Self(-1006);
39}
40
41unsafe impl Encode for CSIndexErrorCode {
42 const ENCODING: Encoding = NSInteger::ENCODING;
43}
44
45unsafe impl RefEncode for CSIndexErrorCode {
46 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
47}
48
49extern_class!(
50 #[unsafe(super(NSObject))]
52 #[derive(Debug, PartialEq, Eq, Hash)]
53 pub struct CSSearchableIndex;
54);
55
56extern_conformance!(
57 unsafe impl NSObjectProtocol for CSSearchableIndex {}
58);
59
60impl CSSearchableIndex {
61 extern_methods!(
62 #[unsafe(method(indexDelegate))]
63 #[unsafe(method_family = none)]
64 pub unsafe fn indexDelegate(
65 &self,
66 ) -> Option<Retained<ProtocolObject<dyn CSSearchableIndexDelegate>>>;
67
68 #[unsafe(method(setIndexDelegate:))]
72 #[unsafe(method_family = none)]
73 pub unsafe fn setIndexDelegate(
74 &self,
75 index_delegate: Option<&ProtocolObject<dyn CSSearchableIndexDelegate>>,
76 );
77
78 #[unsafe(method(isIndexingAvailable))]
79 #[unsafe(method_family = none)]
80 pub unsafe fn isIndexingAvailable() -> bool;
81
82 #[unsafe(method(defaultSearchableIndex))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn defaultSearchableIndex() -> Retained<Self>;
85
86 #[unsafe(method(initWithName:))]
87 #[unsafe(method_family = init)]
88 pub unsafe fn initWithName(this: Allocated<Self>, name: &NSString) -> Retained<Self>;
89
90 #[unsafe(method(initWithName:protectionClass:))]
91 #[unsafe(method_family = init)]
92 pub unsafe fn initWithName_protectionClass(
93 this: Allocated<Self>,
94 name: &NSString,
95 protection_class: Option<&NSFileProtectionType>,
96 ) -> Retained<Self>;
97
98 #[cfg(all(feature = "CSSearchableItem", feature = "block2"))]
99 #[unsafe(method(indexSearchableItems:completionHandler:))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn indexSearchableItems_completionHandler(
102 &self,
103 items: &NSArray<CSSearchableItem>,
104 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
105 );
106
107 #[cfg(feature = "block2")]
108 #[unsafe(method(deleteSearchableItemsWithIdentifiers:completionHandler:))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn deleteSearchableItemsWithIdentifiers_completionHandler(
111 &self,
112 identifiers: &NSArray<NSString>,
113 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
114 );
115
116 #[cfg(feature = "block2")]
117 #[unsafe(method(deleteSearchableItemsWithDomainIdentifiers:completionHandler:))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn deleteSearchableItemsWithDomainIdentifiers_completionHandler(
120 &self,
121 domain_identifiers: &NSArray<NSString>,
122 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
123 );
124
125 #[cfg(feature = "block2")]
126 #[unsafe(method(deleteAllSearchableItemsWithCompletionHandler:))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn deleteAllSearchableItemsWithCompletionHandler(
129 &self,
130 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
131 );
132 );
133}
134
135impl CSSearchableIndex {
137 extern_methods!(
138 #[unsafe(method(init))]
139 #[unsafe(method_family = init)]
140 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
141
142 #[unsafe(method(new))]
143 #[unsafe(method_family = new)]
144 pub unsafe fn new() -> Retained<Self>;
145 );
146}
147
148impl CSSearchableIndex {
150 extern_methods!(
151 #[unsafe(method(beginIndexBatch))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn beginIndexBatch(&self);
154
155 #[cfg(feature = "block2")]
156 #[unsafe(method(endIndexBatchWithExpectedClientState:newClientState:completionHandler:))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn endIndexBatchWithExpectedClientState_newClientState_completionHandler(
159 &self,
160 expected_client_state: Option<&NSData>,
161 new_client_state: &NSData,
162 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
163 );
164
165 #[cfg(feature = "block2")]
166 #[unsafe(method(endIndexBatchWithClientState:completionHandler:))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn endIndexBatchWithClientState_completionHandler(
169 &self,
170 client_state: &NSData,
171 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
172 );
173
174 #[cfg(feature = "block2")]
175 #[unsafe(method(fetchLastClientStateWithCompletionHandler:))]
176 #[unsafe(method_family = none)]
177 pub unsafe fn fetchLastClientStateWithCompletionHandler(
178 &self,
179 completion_handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
180 );
181 );
182}
183
184impl CSSearchableIndex {
186 extern_methods!(
187 #[cfg(all(feature = "block2", feature = "objc2-uniform-type-identifiers"))]
188 #[unsafe(method(fetchDataForBundleIdentifier:itemIdentifier:contentType:completionHandler:))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn fetchDataForBundleIdentifier_itemIdentifier_contentType_completionHandler(
191 &self,
192 bundle_identifier: &NSString,
193 item_identifier: &NSString,
194 content_type: &UTType,
195 completion_handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
196 );
197 );
198}
199
200impl CSSearchableIndex {
202 extern_methods!();
203}
204
205extern_protocol!(
206 pub unsafe trait CSSearchableIndexDelegate: NSObjectProtocol {
208 #[cfg(feature = "block2")]
209 #[unsafe(method(searchableIndex:reindexAllSearchableItemsWithAcknowledgementHandler:))]
210 #[unsafe(method_family = none)]
211 unsafe fn searchableIndex_reindexAllSearchableItemsWithAcknowledgementHandler(
212 &self,
213 searchable_index: &CSSearchableIndex,
214 acknowledgement_handler: &block2::DynBlock<dyn Fn()>,
215 );
216
217 #[cfg(feature = "block2")]
218 #[unsafe(method(searchableIndex:reindexSearchableItemsWithIdentifiers:acknowledgementHandler:))]
219 #[unsafe(method_family = none)]
220 unsafe fn searchableIndex_reindexSearchableItemsWithIdentifiers_acknowledgementHandler(
221 &self,
222 searchable_index: &CSSearchableIndex,
223 identifiers: &NSArray<NSString>,
224 acknowledgement_handler: &block2::DynBlock<dyn Fn()>,
225 );
226
227 #[optional]
228 #[unsafe(method(searchableIndexDidThrottle:))]
229 #[unsafe(method_family = none)]
230 unsafe fn searchableIndexDidThrottle(&self, searchable_index: &CSSearchableIndex);
231
232 #[optional]
233 #[unsafe(method(searchableIndexDidFinishThrottle:))]
234 #[unsafe(method_family = none)]
235 unsafe fn searchableIndexDidFinishThrottle(&self, searchable_index: &CSSearchableIndex);
236
237 #[optional]
238 #[unsafe(method(dataForSearchableIndex:itemIdentifier:typeIdentifier:error:_))]
239 #[unsafe(method_family = none)]
240 unsafe fn dataForSearchableIndex_itemIdentifier_typeIdentifier_error(
241 &self,
242 searchable_index: &CSSearchableIndex,
243 item_identifier: &NSString,
244 type_identifier: &NSString,
245 ) -> Result<Retained<NSData>, Retained<NSError>>;
246
247 #[optional]
248 #[unsafe(method(fileURLForSearchableIndex:itemIdentifier:typeIdentifier:inPlace:error:_))]
249 #[unsafe(method_family = none)]
250 unsafe fn fileURLForSearchableIndex_itemIdentifier_typeIdentifier_inPlace_error(
251 &self,
252 searchable_index: &CSSearchableIndex,
253 item_identifier: &NSString,
254 type_identifier: &NSString,
255 in_place: bool,
256 ) -> Result<Retained<NSURL>, Retained<NSError>>;
257
258 #[cfg(all(feature = "CSSearchableItem", feature = "block2"))]
259 #[optional]
260 #[unsafe(method(searchableItemsForIdentifiers:searchableItemsHandler:))]
261 #[unsafe(method_family = none)]
262 unsafe fn searchableItemsForIdentifiers_searchableItemsHandler(
263 &self,
264 identifiers: &NSArray<NSString>,
265 searchable_items_handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<CSSearchableItem>>)>,
266 );
267
268 #[cfg(feature = "CSSearchableItem")]
269 #[optional]
270 #[unsafe(method(searchableItemsDidUpdate:))]
271 #[unsafe(method_family = none)]
272 unsafe fn searchableItemsDidUpdate(&self, items: &NSArray<CSSearchableItem>);
273 }
274);