1#![allow(unused_imports)]
5#![allow(deprecated)]
6#![allow(non_snake_case)]
7#![allow(non_camel_case_types)]
8#![allow(non_upper_case_globals)]
9#![allow(missing_docs)]
10#![allow(clippy::too_many_arguments)]
11#![allow(clippy::type_complexity)]
12#![allow(clippy::upper_case_acronyms)]
13#![allow(clippy::identity_op)]
14#![allow(clippy::missing_safety_doc)]
15#![allow(clippy::doc_lazy_continuation)]
16#![allow(rustdoc::broken_intra_doc_links)]
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::invalid_html_tags)]
19
20#[link(name = "LatentSemanticMapping", kind = "framework")]
21extern "C" {}
22
23use core::cell::UnsafeCell;
24use core::ffi::*;
25use core::marker::{PhantomData, PhantomPinned};
26use core::ptr::NonNull;
27#[cfg(feature = "objc2")]
28use objc2::__framework_prelude::*;
29use objc2_core_foundation::*;
30
31use crate::*;
32
33pub const kLSMMapOutOfState: c_int = -6640;
35pub const kLSMMapNoSuchCategory: c_int = -6641;
37pub const kLSMMapWriteError: c_int = -6642;
39pub const kLSMMapBadPath: c_int = -6643;
41pub const kLSMMapBadCluster: c_int = -6644;
43pub const kLSMMapOverflow: c_int = -6645;
45
46#[doc(alias = "LSMMapRef")]
50#[repr(C)]
51pub struct LSMMap {
52 inner: [u8; 0],
53 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
54}
55
56cf_type!(
57 unsafe impl LSMMap {}
58);
59#[cfg(feature = "objc2")]
60cf_objc2_type!(
61 unsafe impl RefEncode<"__LSMMap"> for LSMMap {}
62);
63
64unsafe impl ConcreteType for LSMMap {
65 #[doc(alias = "LSMMapGetTypeID")]
67 #[inline]
68 fn type_id() -> CFTypeID {
69 extern "C-unwind" {
70 fn LSMMapGetTypeID() -> CFTypeID;
71 }
72 unsafe { LSMMapGetTypeID() }
73 }
74}
75
76#[doc(alias = "LSMTextRef")]
80#[repr(C)]
81pub struct LSMText {
82 inner: [u8; 0],
83 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
84}
85
86cf_type!(
87 unsafe impl LSMText {}
88);
89#[cfg(feature = "objc2")]
90cf_objc2_type!(
91 unsafe impl RefEncode<"__LSMText"> for LSMText {}
92);
93
94unsafe impl ConcreteType for LSMText {
95 #[doc(alias = "LSMTextGetTypeID")]
97 #[inline]
98 fn type_id() -> CFTypeID {
99 extern "C-unwind" {
100 fn LSMTextGetTypeID() -> CFTypeID;
101 }
102 unsafe { LSMTextGetTypeID() }
103 }
104}
105
106#[doc(alias = "LSMResultRef")]
110#[repr(C)]
111pub struct LSMResult {
112 inner: [u8; 0],
113 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
114}
115
116cf_type!(
117 unsafe impl LSMResult {}
118);
119#[cfg(feature = "objc2")]
120cf_objc2_type!(
121 unsafe impl RefEncode<"__LSMResult"> for LSMResult {}
122);
123
124unsafe impl ConcreteType for LSMResult {
125 #[doc(alias = "LSMResultGetTypeID")]
127 #[inline]
128 fn type_id() -> CFTypeID {
129 extern "C-unwind" {
130 fn LSMResultGetTypeID() -> CFTypeID;
131 }
132 unsafe { LSMResultGetTypeID() }
133 }
134}
135
136pub type LSMCategory = u32;
140
141impl LSMMap {
142 #[doc(alias = "LSMMapCreate")]
144 #[inline]
145 pub unsafe fn new(alloc: Option<&CFAllocator>, flags: CFOptionFlags) -> CFRetained<LSMMap> {
146 extern "C-unwind" {
147 fn LSMMapCreate(
148 alloc: Option<&CFAllocator>,
149 flags: CFOptionFlags,
150 ) -> Option<NonNull<LSMMap>>;
151 }
152 let ret = unsafe { LSMMapCreate(alloc, flags) };
153 let ret =
154 ret.expect("function was marked as returning non-null, but actually returned NULL");
155 unsafe { CFRetained::from_raw(ret) }
156 }
157}
158
159pub const kLSMMapPairs: c_uint = 1;
161pub const kLSMMapTriplets: c_uint = 2;
163pub const kLSMMapHashText: c_uint = 256;
165
166impl LSMMap {
167 #[doc(alias = "LSMMapSetProperties")]
174 #[inline]
175 pub unsafe fn set_properties(&self, properties: &CFDictionary) {
176 extern "C-unwind" {
177 fn LSMMapSetProperties(mapref: &LSMMap, properties: &CFDictionary);
178 }
179 unsafe { LSMMapSetProperties(self, properties) }
180 }
181
182 #[doc(alias = "LSMMapGetProperties")]
185 #[inline]
186 pub unsafe fn properties(&self) -> CFRetained<CFDictionary> {
187 extern "C-unwind" {
188 fn LSMMapGetProperties(mapref: &LSMMap) -> Option<NonNull<CFDictionary>>;
189 }
190 let ret = unsafe { LSMMapGetProperties(self) };
191 let ret =
192 ret.expect("function was marked as returning non-null, but actually returned NULL");
193 unsafe { CFRetained::retain(ret) }
194 }
195
196 #[doc(alias = "LSMMapStartTraining")]
200 #[inline]
201 pub unsafe fn start_training(&self) -> OSStatus {
202 extern "C-unwind" {
203 fn LSMMapStartTraining(mapref: &LSMMap) -> OSStatus;
204 }
205 unsafe { LSMMapStartTraining(self) }
206 }
207
208 #[doc(alias = "LSMMapAddCategory")]
210 #[inline]
211 pub unsafe fn add_category(&self) -> LSMCategory {
212 extern "C-unwind" {
213 fn LSMMapAddCategory(mapref: &LSMMap) -> LSMCategory;
214 }
215 unsafe { LSMMapAddCategory(self) }
216 }
217
218 #[doc(alias = "LSMMapGetCategoryCount")]
220 #[inline]
221 pub unsafe fn category_count(&self) -> CFIndex {
222 extern "C-unwind" {
223 fn LSMMapGetCategoryCount(mapref: &LSMMap) -> CFIndex;
224 }
225 unsafe { LSMMapGetCategoryCount(self) }
226 }
227
228 #[doc(alias = "LSMMapSetStopWords")]
232 #[inline]
233 pub unsafe fn set_stop_words(&self, textref: &LSMText) -> OSStatus {
234 extern "C-unwind" {
235 fn LSMMapSetStopWords(mapref: &LSMMap, textref: &LSMText) -> OSStatus;
236 }
237 unsafe { LSMMapSetStopWords(self, textref) }
238 }
239
240 #[doc(alias = "LSMMapAddText")]
243 #[inline]
244 pub unsafe fn add_text(&self, textref: &LSMText, category: LSMCategory) -> OSStatus {
245 extern "C-unwind" {
246 fn LSMMapAddText(mapref: &LSMMap, textref: &LSMText, category: LSMCategory)
247 -> OSStatus;
248 }
249 unsafe { LSMMapAddText(self, textref, category) }
250 }
251
252 #[doc(alias = "LSMMapAddTextWithWeight")]
256 #[inline]
257 pub unsafe fn add_text_with_weight(
258 &self,
259 textref: &LSMText,
260 category: LSMCategory,
261 weight: c_float,
262 ) -> OSStatus {
263 extern "C-unwind" {
264 fn LSMMapAddTextWithWeight(
265 mapref: &LSMMap,
266 textref: &LSMText,
267 category: LSMCategory,
268 weight: c_float,
269 ) -> OSStatus;
270 }
271 unsafe { LSMMapAddTextWithWeight(self, textref, category, weight) }
272 }
273
274 #[doc(alias = "LSMMapCompile")]
278 #[inline]
279 pub unsafe fn compile(&self) -> OSStatus {
280 extern "C-unwind" {
281 fn LSMMapCompile(mapref: &LSMMap) -> OSStatus;
282 }
283 unsafe { LSMMapCompile(self) }
284 }
285
286 #[doc(alias = "LSMMapCreateClusters")]
294 #[inline]
295 pub unsafe fn new_clusters(
296 alloc: Option<&CFAllocator>,
297 mapref: &LSMMap,
298 subset: Option<&CFArray>,
299 num_clusters: CFIndex,
300 flags: CFOptionFlags,
301 ) -> Option<CFRetained<CFArray>> {
302 extern "C-unwind" {
303 fn LSMMapCreateClusters(
304 alloc: Option<&CFAllocator>,
305 mapref: &LSMMap,
306 subset: Option<&CFArray>,
307 num_clusters: CFIndex,
308 flags: CFOptionFlags,
309 ) -> Option<NonNull<CFArray>>;
310 }
311 let ret = unsafe { LSMMapCreateClusters(alloc, mapref, subset, num_clusters, flags) };
312 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
313 }
314}
315
316pub const kLSMClusterCategories: c_uint = 0;
318pub const kLSMClusterWords: c_uint = 1;
320pub const kLSMClusterTokens: c_uint = 2;
322pub const kLSMClusterKMeans: c_uint = 0;
324pub const kLSMClusterAgglomerative: c_uint = 4;
326
327impl LSMMap {
328 #[doc(alias = "LSMMapApplyClusters")]
334 #[inline]
335 pub unsafe fn apply_clusters(&self, clusters: &CFArray) -> OSStatus {
336 extern "C-unwind" {
337 fn LSMMapApplyClusters(mapref: &LSMMap, clusters: &CFArray) -> OSStatus;
338 }
339 unsafe { LSMMapApplyClusters(self, clusters) }
340 }
341}
342
343impl LSMResult {
344 #[doc(alias = "LSMResultCreate")]
347 #[inline]
348 pub unsafe fn new(
349 alloc: Option<&CFAllocator>,
350 mapref: &LSMMap,
351 textref: &LSMText,
352 num_results: CFIndex,
353 flags: CFOptionFlags,
354 ) -> CFRetained<LSMResult> {
355 extern "C-unwind" {
356 fn LSMResultCreate(
357 alloc: Option<&CFAllocator>,
358 mapref: &LSMMap,
359 textref: &LSMText,
360 num_results: CFIndex,
361 flags: CFOptionFlags,
362 ) -> Option<NonNull<LSMResult>>;
363 }
364 let ret = unsafe { LSMResultCreate(alloc, mapref, textref, num_results, flags) };
365 let ret =
366 ret.expect("function was marked as returning non-null, but actually returned NULL");
367 unsafe { CFRetained::from_raw(ret) }
368 }
369}
370
371pub const kLSMResultBestWords: c_uint = 1;
373
374impl LSMResult {
375 #[doc(alias = "LSMResultGetCount")]
377 #[inline]
378 pub unsafe fn count(&self) -> CFIndex {
379 extern "C-unwind" {
380 fn LSMResultGetCount(result: &LSMResult) -> CFIndex;
381 }
382 unsafe { LSMResultGetCount(self) }
383 }
384
385 #[doc(alias = "LSMResultGetCategory")]
387 #[inline]
388 pub unsafe fn category(&self, n: CFIndex) -> LSMCategory {
389 extern "C-unwind" {
390 fn LSMResultGetCategory(result: &LSMResult, n: CFIndex) -> LSMCategory;
391 }
392 unsafe { LSMResultGetCategory(self, n) }
393 }
394
395 #[doc(alias = "LSMResultGetScore")]
399 #[inline]
400 pub unsafe fn score(&self, n: CFIndex) -> c_float {
401 extern "C-unwind" {
402 fn LSMResultGetScore(result: &LSMResult, n: CFIndex) -> c_float;
403 }
404 unsafe { LSMResultGetScore(self, n) }
405 }
406
407 #[doc(alias = "LSMResultCopyWord")]
409 #[inline]
410 pub unsafe fn word(&self, n: CFIndex) -> Option<CFRetained<CFString>> {
411 extern "C-unwind" {
412 fn LSMResultCopyWord(result: &LSMResult, n: CFIndex) -> Option<NonNull<CFString>>;
413 }
414 let ret = unsafe { LSMResultCopyWord(self, n) };
415 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
416 }
417
418 #[doc(alias = "LSMResultCopyToken")]
420 #[inline]
421 pub unsafe fn token(&self, n: CFIndex) -> Option<CFRetained<CFData>> {
422 extern "C-unwind" {
423 fn LSMResultCopyToken(result: &LSMResult, n: CFIndex) -> Option<NonNull<CFData>>;
424 }
425 let ret = unsafe { LSMResultCopyToken(self, n) };
426 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
427 }
428
429 #[doc(alias = "LSMResultCopyWordCluster")]
431 #[inline]
432 pub unsafe fn word_cluster(&self, n: CFIndex) -> Option<CFRetained<CFArray>> {
433 extern "C-unwind" {
434 fn LSMResultCopyWordCluster(result: &LSMResult, n: CFIndex)
435 -> Option<NonNull<CFArray>>;
436 }
437 let ret = unsafe { LSMResultCopyWordCluster(self, n) };
438 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
439 }
440
441 #[doc(alias = "LSMResultCopyTokenCluster")]
443 #[inline]
444 pub unsafe fn token_cluster(&self, n: CFIndex) -> Option<CFRetained<CFArray>> {
445 extern "C-unwind" {
446 fn LSMResultCopyTokenCluster(
447 result: &LSMResult,
448 n: CFIndex,
449 ) -> Option<NonNull<CFArray>>;
450 }
451 let ret = unsafe { LSMResultCopyTokenCluster(self, n) };
452 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
453 }
454}
455
456impl LSMMap {
457 #[doc(alias = "LSMMapWriteToURL")]
459 #[inline]
460 pub unsafe fn write_to_url(&self, file: &CFURL, flags: CFOptionFlags) -> OSStatus {
461 extern "C-unwind" {
462 fn LSMMapWriteToURL(mapref: &LSMMap, file: &CFURL, flags: CFOptionFlags) -> OSStatus;
463 }
464 unsafe { LSMMapWriteToURL(self, file, flags) }
465 }
466
467 #[doc(alias = "LSMMapCreateFromURL")]
469 #[inline]
470 pub unsafe fn from_url(
471 alloc: Option<&CFAllocator>,
472 file: &CFURL,
473 flags: CFOptionFlags,
474 ) -> Option<CFRetained<LSMMap>> {
475 extern "C-unwind" {
476 fn LSMMapCreateFromURL(
477 alloc: Option<&CFAllocator>,
478 file: &CFURL,
479 flags: CFOptionFlags,
480 ) -> Option<NonNull<LSMMap>>;
481 }
482 let ret = unsafe { LSMMapCreateFromURL(alloc, file, flags) };
483 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
484 }
485}
486
487pub const kLSMMapDiscardCounts: c_uint = 1;
489pub const kLSMMapLoadMutable: c_uint = 2;
491
492impl LSMMap {
493 #[doc(alias = "LSMMapWriteToStream")]
495 #[inline]
496 pub unsafe fn write_to_stream(
497 &self,
498 textref: Option<&LSMText>,
499 stream: &CFWriteStream,
500 options: CFOptionFlags,
501 ) -> OSStatus {
502 extern "C-unwind" {
503 fn LSMMapWriteToStream(
504 mapref: &LSMMap,
505 textref: Option<&LSMText>,
506 stream: &CFWriteStream,
507 options: CFOptionFlags,
508 ) -> OSStatus;
509 }
510 unsafe { LSMMapWriteToStream(self, textref, stream, options) }
511 }
512}
513
514impl LSMText {
515 #[doc(alias = "LSMTextCreate")]
517 #[inline]
518 pub unsafe fn new(alloc: Option<&CFAllocator>, mapref: &LSMMap) -> CFRetained<LSMText> {
519 extern "C-unwind" {
520 fn LSMTextCreate(
521 alloc: Option<&CFAllocator>,
522 mapref: &LSMMap,
523 ) -> Option<NonNull<LSMText>>;
524 }
525 let ret = unsafe { LSMTextCreate(alloc, mapref) };
526 let ret =
527 ret.expect("function was marked as returning non-null, but actually returned NULL");
528 unsafe { CFRetained::from_raw(ret) }
529 }
530
531 #[doc(alias = "LSMTextAddWord")]
534 #[inline]
535 pub unsafe fn add_word(&self, word: &CFString) -> OSStatus {
536 extern "C-unwind" {
537 fn LSMTextAddWord(textref: &LSMText, word: &CFString) -> OSStatus;
538 }
539 unsafe { LSMTextAddWord(self, word) }
540 }
541
542 #[doc(alias = "LSMTextAddWords")]
545 #[inline]
546 pub unsafe fn add_words(
547 &self,
548 words: &CFString,
549 locale: Option<&CFLocale>,
550 flags: CFOptionFlags,
551 ) -> OSStatus {
552 extern "C-unwind" {
553 fn LSMTextAddWords(
554 textref: &LSMText,
555 words: &CFString,
556 locale: Option<&CFLocale>,
557 flags: CFOptionFlags,
558 ) -> OSStatus;
559 }
560 unsafe { LSMTextAddWords(self, words, locale, flags) }
561 }
562}
563
564pub const kLSMTextPreserveCase: c_uint = 1;
566pub const kLSMTextPreserveAcronyms: c_uint = 2;
568pub const kLSMTextApplySpamHeuristics: c_uint = 4;
570
571impl LSMText {
572 #[doc(alias = "LSMTextAddToken")]
576 #[inline]
577 pub unsafe fn add_token(&self, token: &CFData) -> OSStatus {
578 extern "C-unwind" {
579 fn LSMTextAddToken(textref: &LSMText, token: &CFData) -> OSStatus;
580 }
581 unsafe { LSMTextAddToken(self, token) }
582 }
583}
584
585#[deprecated = "renamed to `LSMMap::new`"]
586#[inline]
587pub unsafe extern "C-unwind" fn LSMMapCreate(
588 alloc: Option<&CFAllocator>,
589 flags: CFOptionFlags,
590) -> CFRetained<LSMMap> {
591 extern "C-unwind" {
592 fn LSMMapCreate(
593 alloc: Option<&CFAllocator>,
594 flags: CFOptionFlags,
595 ) -> Option<NonNull<LSMMap>>;
596 }
597 let ret = unsafe { LSMMapCreate(alloc, flags) };
598 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
599 unsafe { CFRetained::from_raw(ret) }
600}
601
602extern "C-unwind" {
603 #[deprecated = "renamed to `LSMMap::set_properties`"]
604 pub fn LSMMapSetProperties(mapref: &LSMMap, properties: &CFDictionary);
605}
606
607#[deprecated = "renamed to `LSMMap::properties`"]
608#[inline]
609pub unsafe extern "C-unwind" fn LSMMapGetProperties(mapref: &LSMMap) -> CFRetained<CFDictionary> {
610 extern "C-unwind" {
611 fn LSMMapGetProperties(mapref: &LSMMap) -> Option<NonNull<CFDictionary>>;
612 }
613 let ret = unsafe { LSMMapGetProperties(mapref) };
614 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
615 unsafe { CFRetained::retain(ret) }
616}
617
618extern "C-unwind" {
619 #[deprecated = "renamed to `LSMMap::start_training`"]
620 pub fn LSMMapStartTraining(mapref: &LSMMap) -> OSStatus;
621}
622
623extern "C-unwind" {
624 #[deprecated = "renamed to `LSMMap::add_category`"]
625 pub fn LSMMapAddCategory(mapref: &LSMMap) -> LSMCategory;
626}
627
628extern "C-unwind" {
629 #[deprecated = "renamed to `LSMMap::category_count`"]
630 pub fn LSMMapGetCategoryCount(mapref: &LSMMap) -> CFIndex;
631}
632
633extern "C-unwind" {
634 #[deprecated = "renamed to `LSMMap::set_stop_words`"]
635 pub fn LSMMapSetStopWords(mapref: &LSMMap, textref: &LSMText) -> OSStatus;
636}
637
638extern "C-unwind" {
639 #[deprecated = "renamed to `LSMMap::add_text`"]
640 pub fn LSMMapAddText(mapref: &LSMMap, textref: &LSMText, category: LSMCategory) -> OSStatus;
641}
642
643extern "C-unwind" {
644 #[deprecated = "renamed to `LSMMap::add_text_with_weight`"]
645 pub fn LSMMapAddTextWithWeight(
646 mapref: &LSMMap,
647 textref: &LSMText,
648 category: LSMCategory,
649 weight: c_float,
650 ) -> OSStatus;
651}
652
653extern "C-unwind" {
654 #[deprecated = "renamed to `LSMMap::compile`"]
655 pub fn LSMMapCompile(mapref: &LSMMap) -> OSStatus;
656}
657
658#[deprecated = "renamed to `LSMMap::new_clusters`"]
659#[inline]
660pub unsafe extern "C-unwind" fn LSMMapCreateClusters(
661 alloc: Option<&CFAllocator>,
662 mapref: &LSMMap,
663 subset: Option<&CFArray>,
664 num_clusters: CFIndex,
665 flags: CFOptionFlags,
666) -> Option<CFRetained<CFArray>> {
667 extern "C-unwind" {
668 fn LSMMapCreateClusters(
669 alloc: Option<&CFAllocator>,
670 mapref: &LSMMap,
671 subset: Option<&CFArray>,
672 num_clusters: CFIndex,
673 flags: CFOptionFlags,
674 ) -> Option<NonNull<CFArray>>;
675 }
676 let ret = unsafe { LSMMapCreateClusters(alloc, mapref, subset, num_clusters, flags) };
677 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
678}
679
680extern "C-unwind" {
681 #[deprecated = "renamed to `LSMMap::apply_clusters`"]
682 pub fn LSMMapApplyClusters(mapref: &LSMMap, clusters: &CFArray) -> OSStatus;
683}
684
685#[deprecated = "renamed to `LSMResult::new`"]
686#[inline]
687pub unsafe extern "C-unwind" fn LSMResultCreate(
688 alloc: Option<&CFAllocator>,
689 mapref: &LSMMap,
690 textref: &LSMText,
691 num_results: CFIndex,
692 flags: CFOptionFlags,
693) -> CFRetained<LSMResult> {
694 extern "C-unwind" {
695 fn LSMResultCreate(
696 alloc: Option<&CFAllocator>,
697 mapref: &LSMMap,
698 textref: &LSMText,
699 num_results: CFIndex,
700 flags: CFOptionFlags,
701 ) -> Option<NonNull<LSMResult>>;
702 }
703 let ret = unsafe { LSMResultCreate(alloc, mapref, textref, num_results, flags) };
704 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
705 unsafe { CFRetained::from_raw(ret) }
706}
707
708extern "C-unwind" {
709 #[deprecated = "renamed to `LSMResult::count`"]
710 pub fn LSMResultGetCount(result: &LSMResult) -> CFIndex;
711}
712
713extern "C-unwind" {
714 #[deprecated = "renamed to `LSMResult::category`"]
715 pub fn LSMResultGetCategory(result: &LSMResult, n: CFIndex) -> LSMCategory;
716}
717
718extern "C-unwind" {
719 #[deprecated = "renamed to `LSMResult::score`"]
720 pub fn LSMResultGetScore(result: &LSMResult, n: CFIndex) -> c_float;
721}
722
723#[deprecated = "renamed to `LSMResult::word`"]
724#[inline]
725pub unsafe extern "C-unwind" fn LSMResultCopyWord(
726 result: &LSMResult,
727 n: CFIndex,
728) -> Option<CFRetained<CFString>> {
729 extern "C-unwind" {
730 fn LSMResultCopyWord(result: &LSMResult, n: CFIndex) -> Option<NonNull<CFString>>;
731 }
732 let ret = unsafe { LSMResultCopyWord(result, n) };
733 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
734}
735
736#[deprecated = "renamed to `LSMResult::token`"]
737#[inline]
738pub unsafe extern "C-unwind" fn LSMResultCopyToken(
739 result: &LSMResult,
740 n: CFIndex,
741) -> Option<CFRetained<CFData>> {
742 extern "C-unwind" {
743 fn LSMResultCopyToken(result: &LSMResult, n: CFIndex) -> Option<NonNull<CFData>>;
744 }
745 let ret = unsafe { LSMResultCopyToken(result, n) };
746 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
747}
748
749#[deprecated = "renamed to `LSMResult::word_cluster`"]
750#[inline]
751pub unsafe extern "C-unwind" fn LSMResultCopyWordCluster(
752 result: &LSMResult,
753 n: CFIndex,
754) -> Option<CFRetained<CFArray>> {
755 extern "C-unwind" {
756 fn LSMResultCopyWordCluster(result: &LSMResult, n: CFIndex) -> Option<NonNull<CFArray>>;
757 }
758 let ret = unsafe { LSMResultCopyWordCluster(result, n) };
759 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
760}
761
762#[deprecated = "renamed to `LSMResult::token_cluster`"]
763#[inline]
764pub unsafe extern "C-unwind" fn LSMResultCopyTokenCluster(
765 result: &LSMResult,
766 n: CFIndex,
767) -> Option<CFRetained<CFArray>> {
768 extern "C-unwind" {
769 fn LSMResultCopyTokenCluster(result: &LSMResult, n: CFIndex) -> Option<NonNull<CFArray>>;
770 }
771 let ret = unsafe { LSMResultCopyTokenCluster(result, n) };
772 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
773}
774
775extern "C-unwind" {
776 #[deprecated = "renamed to `LSMMap::write_to_url`"]
777 pub fn LSMMapWriteToURL(mapref: &LSMMap, file: &CFURL, flags: CFOptionFlags) -> OSStatus;
778}
779
780#[deprecated = "renamed to `LSMMap::from_url`"]
781#[inline]
782pub unsafe extern "C-unwind" fn LSMMapCreateFromURL(
783 alloc: Option<&CFAllocator>,
784 file: &CFURL,
785 flags: CFOptionFlags,
786) -> Option<CFRetained<LSMMap>> {
787 extern "C-unwind" {
788 fn LSMMapCreateFromURL(
789 alloc: Option<&CFAllocator>,
790 file: &CFURL,
791 flags: CFOptionFlags,
792 ) -> Option<NonNull<LSMMap>>;
793 }
794 let ret = unsafe { LSMMapCreateFromURL(alloc, file, flags) };
795 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
796}
797
798extern "C-unwind" {
799 #[deprecated = "renamed to `LSMMap::write_to_stream`"]
800 pub fn LSMMapWriteToStream(
801 mapref: &LSMMap,
802 textref: Option<&LSMText>,
803 stream: &CFWriteStream,
804 options: CFOptionFlags,
805 ) -> OSStatus;
806}
807
808#[deprecated = "renamed to `LSMText::new`"]
809#[inline]
810pub unsafe extern "C-unwind" fn LSMTextCreate(
811 alloc: Option<&CFAllocator>,
812 mapref: &LSMMap,
813) -> CFRetained<LSMText> {
814 extern "C-unwind" {
815 fn LSMTextCreate(alloc: Option<&CFAllocator>, mapref: &LSMMap) -> Option<NonNull<LSMText>>;
816 }
817 let ret = unsafe { LSMTextCreate(alloc, mapref) };
818 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
819 unsafe { CFRetained::from_raw(ret) }
820}
821
822extern "C-unwind" {
823 #[deprecated = "renamed to `LSMText::add_word`"]
824 pub fn LSMTextAddWord(textref: &LSMText, word: &CFString) -> OSStatus;
825}
826
827extern "C-unwind" {
828 #[deprecated = "renamed to `LSMText::add_words`"]
829 pub fn LSMTextAddWords(
830 textref: &LSMText,
831 words: &CFString,
832 locale: Option<&CFLocale>,
833 flags: CFOptionFlags,
834 ) -> OSStatus;
835}
836
837extern "C-unwind" {
838 #[deprecated = "renamed to `LSMText::add_token`"]
839 pub fn LSMTextAddToken(textref: &LSMText, token: &CFData) -> OSStatus;
840}