1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9
10use crate::*;
11
12pub const kCFCoreFoundationVersionNumber10_0: c_float = 196.40;
14pub const kCFCoreFoundationVersionNumber10_0_3: c_float = 196.50;
16pub const kCFCoreFoundationVersionNumber10_1: c_float = 226.00;
18pub const kCFCoreFoundationVersionNumber10_1_1: c_float = 226.00;
20pub const kCFCoreFoundationVersionNumber10_1_2: c_float = 227.20;
22pub const kCFCoreFoundationVersionNumber10_1_3: c_float = 227.20;
24pub const kCFCoreFoundationVersionNumber10_1_4: c_float = 227.30;
26pub const kCFCoreFoundationVersionNumber10_2: c_float = 263.00;
28pub const kCFCoreFoundationVersionNumber10_2_1: c_float = 263.10;
30pub const kCFCoreFoundationVersionNumber10_2_2: c_float = 263.10;
32pub const kCFCoreFoundationVersionNumber10_2_3: c_float = 263.30;
34pub const kCFCoreFoundationVersionNumber10_2_4: c_float = 263.30;
36pub const kCFCoreFoundationVersionNumber10_2_5: c_float = 263.50;
38pub const kCFCoreFoundationVersionNumber10_2_6: c_float = 263.50;
40pub const kCFCoreFoundationVersionNumber10_2_7: c_float = 263.50;
42pub const kCFCoreFoundationVersionNumber10_2_8: c_float = 263.50;
44pub const kCFCoreFoundationVersionNumber10_3: c_float = 299.00;
46pub const kCFCoreFoundationVersionNumber10_3_1: c_float = 299.00;
48pub const kCFCoreFoundationVersionNumber10_3_2: c_float = 299.00;
50pub const kCFCoreFoundationVersionNumber10_3_3: c_float = 299.30;
52pub const kCFCoreFoundationVersionNumber10_3_4: c_float = 299.31;
54pub const kCFCoreFoundationVersionNumber10_3_5: c_float = 299.31;
56pub const kCFCoreFoundationVersionNumber10_3_6: c_float = 299.32;
58pub const kCFCoreFoundationVersionNumber10_3_7: c_float = 299.33;
60pub const kCFCoreFoundationVersionNumber10_3_8: c_float = 299.33;
62pub const kCFCoreFoundationVersionNumber10_3_9: c_float = 299.35;
64pub const kCFCoreFoundationVersionNumber10_4: c_float = 368.00;
66pub const kCFCoreFoundationVersionNumber10_4_1: c_float = 368.10;
68pub const kCFCoreFoundationVersionNumber10_4_2: c_float = 368.11;
70pub const kCFCoreFoundationVersionNumber10_4_3: c_float = 368.18;
72pub const kCFCoreFoundationVersionNumber10_4_4_Intel: c_float = 368.26;
74pub const kCFCoreFoundationVersionNumber10_4_4_PowerPC: c_float = 368.25;
76pub const kCFCoreFoundationVersionNumber10_4_5_Intel: c_float = 368.26;
78pub const kCFCoreFoundationVersionNumber10_4_5_PowerPC: c_float = 368.25;
80pub const kCFCoreFoundationVersionNumber10_4_6_Intel: c_float = 368.26;
82pub const kCFCoreFoundationVersionNumber10_4_6_PowerPC: c_float = 368.25;
84pub const kCFCoreFoundationVersionNumber10_4_7: c_float = 368.27;
86pub const kCFCoreFoundationVersionNumber10_4_8: c_float = 368.27;
88pub const kCFCoreFoundationVersionNumber10_4_9: c_float = 368.28;
90pub const kCFCoreFoundationVersionNumber10_4_10: c_float = 368.28;
92pub const kCFCoreFoundationVersionNumber10_4_11: c_float = 368.31;
94pub const kCFCoreFoundationVersionNumber10_5: c_float = 476.00;
96pub const kCFCoreFoundationVersionNumber10_5_1: c_float = 476.00;
98pub const kCFCoreFoundationVersionNumber10_5_2: c_float = 476.10;
100pub const kCFCoreFoundationVersionNumber10_5_3: c_float = 476.13;
102pub const kCFCoreFoundationVersionNumber10_5_4: c_float = 476.14;
104pub const kCFCoreFoundationVersionNumber10_5_5: c_float = 476.15;
106pub const kCFCoreFoundationVersionNumber10_5_6: c_float = 476.17;
108pub const kCFCoreFoundationVersionNumber10_5_7: c_float = 476.18;
110pub const kCFCoreFoundationVersionNumber10_5_8: c_float = 476.19;
112pub const kCFCoreFoundationVersionNumber10_6: c_float = 550.00;
114pub const kCFCoreFoundationVersionNumber10_6_1: c_float = 550.00;
116pub const kCFCoreFoundationVersionNumber10_6_2: c_float = 550.13;
118pub const kCFCoreFoundationVersionNumber10_6_3: c_float = 550.19;
120pub const kCFCoreFoundationVersionNumber10_6_4: c_float = 550.29;
122pub const kCFCoreFoundationVersionNumber10_6_5: c_float = 550.42;
124pub const kCFCoreFoundationVersionNumber10_6_6: c_float = 550.42;
126pub const kCFCoreFoundationVersionNumber10_6_7: c_float = 550.42;
128pub const kCFCoreFoundationVersionNumber10_6_8: c_float = 550.43;
130pub const kCFCoreFoundationVersionNumber10_7: c_float = 635.00;
132pub const kCFCoreFoundationVersionNumber10_7_1: c_float = 635.00;
134pub const kCFCoreFoundationVersionNumber10_7_2: c_float = 635.15;
136pub const kCFCoreFoundationVersionNumber10_7_3: c_float = 635.19;
138pub const kCFCoreFoundationVersionNumber10_7_4: c_float = 635.21;
140pub const kCFCoreFoundationVersionNumber10_7_5: c_float = 635.21;
142pub const kCFCoreFoundationVersionNumber10_8: c_float = 744.00;
144pub const kCFCoreFoundationVersionNumber10_8_1: c_float = 744.00;
146pub const kCFCoreFoundationVersionNumber10_8_2: c_float = 744.12;
148pub const kCFCoreFoundationVersionNumber10_8_3: c_float = 744.18;
150pub const kCFCoreFoundationVersionNumber10_8_4: c_float = 744.19;
152pub const kCFCoreFoundationVersionNumber10_9: c_float = 855.11;
154pub const kCFCoreFoundationVersionNumber10_9_1: c_float = 855.11;
156pub const kCFCoreFoundationVersionNumber10_9_2: c_float = 855.14;
158pub const kCFCoreFoundationVersionNumber10_10: c_float = 1151.16;
160pub const kCFCoreFoundationVersionNumber10_10_1: c_float = 1151.16;
162pub const kCFCoreFoundationVersionNumber10_10_2: c_uint = 1152;
164pub const kCFCoreFoundationVersionNumber10_10_3: c_float = 1153.18;
166pub const kCFCoreFoundationVersionNumber10_10_4: c_float = 1153.18;
168pub const kCFCoreFoundationVersionNumber10_10_5: c_float = 1153.18;
170pub const kCFCoreFoundationVersionNumber10_10_Max: c_uint = 1199;
172pub const kCFCoreFoundationVersionNumber10_11: c_uint = 1253;
174pub const kCFCoreFoundationVersionNumber10_11_1: c_float = 1255.1;
176pub const kCFCoreFoundationVersionNumber10_11_2: c_float = 1256.14;
178pub const kCFCoreFoundationVersionNumber10_11_3: c_float = 1256.14;
180pub const kCFCoreFoundationVersionNumber10_11_4: c_float = 1258.1;
182pub const kCFCoreFoundationVersionNumber10_11_Max: c_uint = 1299;
184pub type CFAllocatorTypeID = c_ulonglong;
186
187extern "C" {
188 pub static kCFCoreFoundationVersionNumber: c_double;
190}
191
192#[repr(C)]
194pub struct CFString {
195 inner: [u8; 0],
196 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
197}
198
199cf_type!(
200 unsafe impl CFString {}
201);
202#[cfg(feature = "objc2")]
203cf_objc2_type!(
204 unsafe impl RefEncode<"__CFString"> for CFString {}
205);
206
207#[repr(C)]
209pub struct CFMutableString {
210 inner: [u8; 0],
211 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
212}
213
214cf_type!(
215 unsafe impl CFMutableString: CFString {}
216);
217#[cfg(feature = "objc2")]
218cf_objc2_type!(
219 unsafe impl RefEncode<"__CFString"> for CFMutableString {}
220);
221
222pub type CFPropertyList = CFType;
224
225#[repr(transparent)]
228#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
229pub struct CFComparisonResult(pub CFIndex);
230impl CFComparisonResult {
231 #[doc(alias = "kCFCompareLessThan")]
232 pub const CompareLessThan: Self = Self(-1);
233 #[doc(alias = "kCFCompareEqualTo")]
234 pub const CompareEqualTo: Self = Self(0);
235 #[doc(alias = "kCFCompareGreaterThan")]
236 pub const CompareGreaterThan: Self = Self(1);
237}
238
239#[cfg(feature = "objc2")]
240unsafe impl Encode for CFComparisonResult {
241 const ENCODING: Encoding = CFIndex::ENCODING;
242}
243
244#[cfg(feature = "objc2")]
245unsafe impl RefEncode for CFComparisonResult {
246 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
247}
248
249pub type CFComparatorFunction = Option<
251 unsafe extern "C-unwind" fn(*const c_void, *const c_void, *mut c_void) -> CFComparisonResult,
252>;
253
254pub static kCFNotFound: CFIndex = -1;
256
257#[repr(C)]
259#[derive(Clone, Copy, Debug, PartialEq)]
260pub struct CFRange {
261 pub location: CFIndex,
262 pub length: CFIndex,
263}
264
265#[cfg(feature = "objc2")]
266unsafe impl Encode for CFRange {
267 const ENCODING: Encoding = Encoding::Struct("?", &[<CFIndex>::ENCODING, <CFIndex>::ENCODING]);
268}
269
270#[cfg(feature = "objc2")]
271unsafe impl RefEncode for CFRange {
272 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
273}
274
275#[repr(C)]
277pub struct CFNull {
278 inner: [u8; 0],
279 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
280}
281
282cf_type!(
283 unsafe impl CFNull {}
284);
285#[cfg(feature = "objc2")]
286cf_objc2_type!(
287 unsafe impl RefEncode<"__CFNull"> for CFNull {}
288);
289
290unsafe impl ConcreteType for CFNull {
291 #[doc(alias = "CFNullGetTypeID")]
292 #[inline]
293 fn type_id() -> CFTypeID {
294 extern "C-unwind" {
295 fn CFNullGetTypeID() -> CFTypeID;
296 }
297 unsafe { CFNullGetTypeID() }
298 }
299}
300
301extern "C" {
302 pub static kCFNull: Option<&'static CFNull>;
304}
305
306#[repr(C)]
308pub struct CFAllocator {
309 inner: [u8; 0],
310 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
311}
312
313cf_type!(
314 unsafe impl CFAllocator {}
315);
316#[cfg(feature = "objc2")]
317cf_objc2_type!(
318 unsafe impl RefEncode<"__CFAllocator"> for CFAllocator {}
319);
320
321extern "C" {
322 pub static kCFAllocatorDefault: Option<&'static CFAllocator>;
324}
325
326extern "C" {
327 pub static kCFAllocatorSystemDefault: Option<&'static CFAllocator>;
329}
330
331extern "C" {
332 pub static kCFAllocatorMalloc: Option<&'static CFAllocator>;
334}
335
336extern "C" {
337 pub static kCFAllocatorMallocZone: Option<&'static CFAllocator>;
339}
340
341extern "C" {
342 pub static kCFAllocatorNull: Option<&'static CFAllocator>;
344}
345
346extern "C" {
347 pub static kCFAllocatorUseContext: Option<&'static CFAllocator>;
349}
350
351pub type CFAllocatorRetainCallBack =
353 Option<unsafe extern "C-unwind" fn(*const c_void) -> *const c_void>;
354
355pub type CFAllocatorReleaseCallBack = Option<unsafe extern "C-unwind" fn(*const c_void)>;
357
358pub type CFAllocatorCopyDescriptionCallBack =
360 Option<unsafe extern "C-unwind" fn(*const c_void) -> *const CFString>;
361
362pub type CFAllocatorAllocateCallBack =
364 Option<unsafe extern "C-unwind" fn(CFIndex, CFOptionFlags, *mut c_void) -> *mut c_void>;
365
366pub type CFAllocatorReallocateCallBack = Option<
368 unsafe extern "C-unwind" fn(*mut c_void, CFIndex, CFOptionFlags, *mut c_void) -> *mut c_void,
369>;
370
371pub type CFAllocatorDeallocateCallBack =
373 Option<unsafe extern "C-unwind" fn(*mut c_void, *mut c_void)>;
374
375pub type CFAllocatorPreferredSizeCallBack =
377 Option<unsafe extern "C-unwind" fn(CFIndex, CFOptionFlags, *mut c_void) -> CFIndex>;
378
379#[repr(C)]
381#[derive(Clone, Copy, Debug, PartialEq)]
382pub struct CFAllocatorContext {
383 pub version: CFIndex,
384 pub info: *mut c_void,
385 pub retain: CFAllocatorRetainCallBack,
386 pub release: CFAllocatorReleaseCallBack,
387 pub copyDescription: CFAllocatorCopyDescriptionCallBack,
388 pub allocate: CFAllocatorAllocateCallBack,
389 pub reallocate: CFAllocatorReallocateCallBack,
390 pub deallocate: CFAllocatorDeallocateCallBack,
391 pub preferredSize: CFAllocatorPreferredSizeCallBack,
392}
393
394#[cfg(feature = "objc2")]
395unsafe impl Encode for CFAllocatorContext {
396 const ENCODING: Encoding = Encoding::Struct(
397 "?",
398 &[
399 <CFIndex>::ENCODING,
400 <*mut c_void>::ENCODING,
401 <CFAllocatorRetainCallBack>::ENCODING,
402 <CFAllocatorReleaseCallBack>::ENCODING,
403 <CFAllocatorCopyDescriptionCallBack>::ENCODING,
404 <CFAllocatorAllocateCallBack>::ENCODING,
405 <CFAllocatorReallocateCallBack>::ENCODING,
406 <CFAllocatorDeallocateCallBack>::ENCODING,
407 <CFAllocatorPreferredSizeCallBack>::ENCODING,
408 ],
409 );
410}
411
412#[cfg(feature = "objc2")]
413unsafe impl RefEncode for CFAllocatorContext {
414 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
415}
416
417unsafe impl ConcreteType for CFAllocator {
418 #[doc(alias = "CFAllocatorGetTypeID")]
419 #[inline]
420 fn type_id() -> CFTypeID {
421 extern "C-unwind" {
422 fn CFAllocatorGetTypeID() -> CFTypeID;
423 }
424 unsafe { CFAllocatorGetTypeID() }
425 }
426}
427
428impl CFAllocator {
429 #[doc(alias = "CFAllocatorSetDefault")]
430 #[inline]
431 pub fn set_default(allocator: Option<&CFAllocator>) {
432 extern "C-unwind" {
433 fn CFAllocatorSetDefault(allocator: Option<&CFAllocator>);
434 }
435 unsafe { CFAllocatorSetDefault(allocator) }
436 }
437
438 #[doc(alias = "CFAllocatorGetDefault")]
439 #[inline]
440 pub fn default() -> Option<CFRetained<CFAllocator>> {
441 extern "C-unwind" {
442 fn CFAllocatorGetDefault() -> Option<NonNull<CFAllocator>>;
443 }
444 let ret = unsafe { CFAllocatorGetDefault() };
445 ret.map(|ret| unsafe { CFRetained::retain(ret) })
446 }
447
448 #[doc(alias = "CFAllocatorCreate")]
449 #[inline]
450 pub unsafe fn new(
451 allocator: Option<&CFAllocator>,
452 context: *mut CFAllocatorContext,
453 ) -> Option<CFRetained<CFAllocator>> {
454 extern "C-unwind" {
455 fn CFAllocatorCreate(
456 allocator: Option<&CFAllocator>,
457 context: *mut CFAllocatorContext,
458 ) -> Option<NonNull<CFAllocator>>;
459 }
460 let ret = unsafe { CFAllocatorCreate(allocator, context) };
461 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
462 }
463
464 #[doc(alias = "CFAllocatorAllocateTyped")]
465 #[inline]
466 pub unsafe fn allocate_typed(
467 allocator: Option<&CFAllocator>,
468 size: CFIndex,
469 descriptor: CFAllocatorTypeID,
470 hint: CFOptionFlags,
471 ) -> *mut c_void {
472 extern "C-unwind" {
473 fn CFAllocatorAllocateTyped(
474 allocator: Option<&CFAllocator>,
475 size: CFIndex,
476 descriptor: CFAllocatorTypeID,
477 hint: CFOptionFlags,
478 ) -> *mut c_void;
479 }
480 unsafe { CFAllocatorAllocateTyped(allocator, size, descriptor, hint) }
481 }
482
483 #[doc(alias = "CFAllocatorReallocateTyped")]
484 #[inline]
485 pub unsafe fn reallocate_typed(
486 allocator: Option<&CFAllocator>,
487 ptr: *mut c_void,
488 newsize: CFIndex,
489 descriptor: CFAllocatorTypeID,
490 hint: CFOptionFlags,
491 ) -> *mut c_void {
492 extern "C-unwind" {
493 fn CFAllocatorReallocateTyped(
494 allocator: Option<&CFAllocator>,
495 ptr: *mut c_void,
496 newsize: CFIndex,
497 descriptor: CFAllocatorTypeID,
498 hint: CFOptionFlags,
499 ) -> *mut c_void;
500 }
501 unsafe { CFAllocatorReallocateTyped(allocator, ptr, newsize, descriptor, hint) }
502 }
503
504 #[doc(alias = "CFAllocatorAllocateBytes")]
505 #[inline]
506 pub fn allocate_bytes(
507 allocator: Option<&CFAllocator>,
508 size: CFIndex,
509 hint: CFOptionFlags,
510 ) -> *mut c_void {
511 extern "C-unwind" {
512 fn CFAllocatorAllocateBytes(
513 allocator: Option<&CFAllocator>,
514 size: CFIndex,
515 hint: CFOptionFlags,
516 ) -> *mut c_void;
517 }
518 unsafe { CFAllocatorAllocateBytes(allocator, size, hint) }
519 }
520
521 #[doc(alias = "CFAllocatorReallocateBytes")]
522 #[inline]
523 pub unsafe fn reallocate_bytes(
524 allocator: Option<&CFAllocator>,
525 ptr: *mut c_void,
526 newsize: CFIndex,
527 hint: CFOptionFlags,
528 ) -> *mut c_void {
529 extern "C-unwind" {
530 fn CFAllocatorReallocateBytes(
531 allocator: Option<&CFAllocator>,
532 ptr: *mut c_void,
533 newsize: CFIndex,
534 hint: CFOptionFlags,
535 ) -> *mut c_void;
536 }
537 unsafe { CFAllocatorReallocateBytes(allocator, ptr, newsize, hint) }
538 }
539
540 #[doc(alias = "CFAllocatorAllocate")]
541 #[inline]
542 pub fn allocate(
543 allocator: Option<&CFAllocator>,
544 size: CFIndex,
545 hint: CFOptionFlags,
546 ) -> *mut c_void {
547 extern "C-unwind" {
548 fn CFAllocatorAllocate(
549 allocator: Option<&CFAllocator>,
550 size: CFIndex,
551 hint: CFOptionFlags,
552 ) -> *mut c_void;
553 }
554 unsafe { CFAllocatorAllocate(allocator, size, hint) }
555 }
556
557 #[doc(alias = "CFAllocatorReallocate")]
558 #[inline]
559 pub unsafe fn reallocate(
560 allocator: Option<&CFAllocator>,
561 ptr: *mut c_void,
562 newsize: CFIndex,
563 hint: CFOptionFlags,
564 ) -> *mut c_void {
565 extern "C-unwind" {
566 fn CFAllocatorReallocate(
567 allocator: Option<&CFAllocator>,
568 ptr: *mut c_void,
569 newsize: CFIndex,
570 hint: CFOptionFlags,
571 ) -> *mut c_void;
572 }
573 unsafe { CFAllocatorReallocate(allocator, ptr, newsize, hint) }
574 }
575
576 #[doc(alias = "CFAllocatorDeallocate")]
577 #[inline]
578 pub unsafe fn deallocate(allocator: Option<&CFAllocator>, ptr: *mut c_void) {
579 extern "C-unwind" {
580 fn CFAllocatorDeallocate(allocator: Option<&CFAllocator>, ptr: *mut c_void);
581 }
582 unsafe { CFAllocatorDeallocate(allocator, ptr) }
583 }
584
585 #[doc(alias = "CFAllocatorGetPreferredSizeForSize")]
586 #[inline]
587 pub fn preferred_size_for_size(
588 allocator: Option<&CFAllocator>,
589 size: CFIndex,
590 hint: CFOptionFlags,
591 ) -> CFIndex {
592 extern "C-unwind" {
593 fn CFAllocatorGetPreferredSizeForSize(
594 allocator: Option<&CFAllocator>,
595 size: CFIndex,
596 hint: CFOptionFlags,
597 ) -> CFIndex;
598 }
599 unsafe { CFAllocatorGetPreferredSizeForSize(allocator, size, hint) }
600 }
601
602 #[doc(alias = "CFAllocatorGetContext")]
603 #[inline]
604 pub unsafe fn context(allocator: Option<&CFAllocator>, context: *mut CFAllocatorContext) {
605 extern "C-unwind" {
606 fn CFAllocatorGetContext(
607 allocator: Option<&CFAllocator>,
608 context: *mut CFAllocatorContext,
609 );
610 }
611 unsafe { CFAllocatorGetContext(allocator, context) }
612 }
613}
614
615#[inline]
616pub extern "C-unwind" fn CFGetTypeID(cf: Option<&CFType>) -> CFTypeID {
617 extern "C-unwind" {
618 fn CFGetTypeID(cf: Option<&CFType>) -> CFTypeID;
619 }
620 unsafe { CFGetTypeID(cf) }
621}
622
623#[inline]
624pub extern "C-unwind" fn CFCopyTypeIDDescription(
625 type_id: CFTypeID,
626) -> Option<CFRetained<CFString>> {
627 extern "C-unwind" {
628 fn CFCopyTypeIDDescription(type_id: CFTypeID) -> Option<NonNull<CFString>>;
629 }
630 let ret = unsafe { CFCopyTypeIDDescription(type_id) };
631 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
632}
633
634#[inline]
635pub extern "C-unwind" fn CFGetRetainCount(cf: Option<&CFType>) -> CFIndex {
636 extern "C-unwind" {
637 fn CFGetRetainCount(cf: Option<&CFType>) -> CFIndex;
638 }
639 unsafe { CFGetRetainCount(cf) }
640}
641
642#[inline]
643pub extern "C-unwind" fn CFEqual(cf1: Option<&CFType>, cf2: Option<&CFType>) -> bool {
644 extern "C-unwind" {
645 fn CFEqual(cf1: Option<&CFType>, cf2: Option<&CFType>) -> Boolean;
646 }
647 let ret = unsafe { CFEqual(cf1, cf2) };
648 ret != 0
649}
650
651#[inline]
652pub extern "C-unwind" fn CFHash(cf: Option<&CFType>) -> CFHashCode {
653 extern "C-unwind" {
654 fn CFHash(cf: Option<&CFType>) -> CFHashCode;
655 }
656 unsafe { CFHash(cf) }
657}
658
659#[inline]
660pub extern "C-unwind" fn CFCopyDescription(cf: Option<&CFType>) -> Option<CFRetained<CFString>> {
661 extern "C-unwind" {
662 fn CFCopyDescription(cf: Option<&CFType>) -> Option<NonNull<CFString>>;
663 }
664 let ret = unsafe { CFCopyDescription(cf) };
665 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
666}
667
668#[inline]
669pub extern "C-unwind" fn CFGetAllocator(cf: Option<&CFType>) -> Option<CFRetained<CFAllocator>> {
670 extern "C-unwind" {
671 fn CFGetAllocator(cf: Option<&CFType>) -> Option<NonNull<CFAllocator>>;
672 }
673 let ret = unsafe { CFGetAllocator(cf) };
674 ret.map(|ret| unsafe { CFRetained::retain(ret) })
675}
676
677#[deprecated = "renamed to `CFAllocator::set_default`"]
678#[inline]
679pub extern "C-unwind" fn CFAllocatorSetDefault(allocator: Option<&CFAllocator>) {
680 extern "C-unwind" {
681 fn CFAllocatorSetDefault(allocator: Option<&CFAllocator>);
682 }
683 unsafe { CFAllocatorSetDefault(allocator) }
684}
685
686#[deprecated = "renamed to `CFAllocator::default`"]
687#[inline]
688pub extern "C-unwind" fn CFAllocatorGetDefault() -> Option<CFRetained<CFAllocator>> {
689 extern "C-unwind" {
690 fn CFAllocatorGetDefault() -> Option<NonNull<CFAllocator>>;
691 }
692 let ret = unsafe { CFAllocatorGetDefault() };
693 ret.map(|ret| unsafe { CFRetained::retain(ret) })
694}
695
696#[deprecated = "renamed to `CFAllocator::new`"]
697#[inline]
698pub unsafe extern "C-unwind" fn CFAllocatorCreate(
699 allocator: Option<&CFAllocator>,
700 context: *mut CFAllocatorContext,
701) -> Option<CFRetained<CFAllocator>> {
702 extern "C-unwind" {
703 fn CFAllocatorCreate(
704 allocator: Option<&CFAllocator>,
705 context: *mut CFAllocatorContext,
706 ) -> Option<NonNull<CFAllocator>>;
707 }
708 let ret = unsafe { CFAllocatorCreate(allocator, context) };
709 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
710}
711
712extern "C-unwind" {
713 #[deprecated = "renamed to `CFAllocator::allocate_typed`"]
714 pub fn CFAllocatorAllocateTyped(
715 allocator: Option<&CFAllocator>,
716 size: CFIndex,
717 descriptor: CFAllocatorTypeID,
718 hint: CFOptionFlags,
719 ) -> *mut c_void;
720}
721
722extern "C-unwind" {
723 #[deprecated = "renamed to `CFAllocator::reallocate_typed`"]
724 pub fn CFAllocatorReallocateTyped(
725 allocator: Option<&CFAllocator>,
726 ptr: *mut c_void,
727 newsize: CFIndex,
728 descriptor: CFAllocatorTypeID,
729 hint: CFOptionFlags,
730 ) -> *mut c_void;
731}
732
733#[deprecated = "renamed to `CFAllocator::allocate_bytes`"]
734#[inline]
735pub extern "C-unwind" fn CFAllocatorAllocateBytes(
736 allocator: Option<&CFAllocator>,
737 size: CFIndex,
738 hint: CFOptionFlags,
739) -> *mut c_void {
740 extern "C-unwind" {
741 fn CFAllocatorAllocateBytes(
742 allocator: Option<&CFAllocator>,
743 size: CFIndex,
744 hint: CFOptionFlags,
745 ) -> *mut c_void;
746 }
747 unsafe { CFAllocatorAllocateBytes(allocator, size, hint) }
748}
749
750extern "C-unwind" {
751 #[deprecated = "renamed to `CFAllocator::reallocate_bytes`"]
752 pub fn CFAllocatorReallocateBytes(
753 allocator: Option<&CFAllocator>,
754 ptr: *mut c_void,
755 newsize: CFIndex,
756 hint: CFOptionFlags,
757 ) -> *mut c_void;
758}
759
760#[deprecated = "renamed to `CFAllocator::allocate`"]
761#[inline]
762pub extern "C-unwind" fn CFAllocatorAllocate(
763 allocator: Option<&CFAllocator>,
764 size: CFIndex,
765 hint: CFOptionFlags,
766) -> *mut c_void {
767 extern "C-unwind" {
768 fn CFAllocatorAllocate(
769 allocator: Option<&CFAllocator>,
770 size: CFIndex,
771 hint: CFOptionFlags,
772 ) -> *mut c_void;
773 }
774 unsafe { CFAllocatorAllocate(allocator, size, hint) }
775}
776
777extern "C-unwind" {
778 #[deprecated = "renamed to `CFAllocator::reallocate`"]
779 pub fn CFAllocatorReallocate(
780 allocator: Option<&CFAllocator>,
781 ptr: *mut c_void,
782 newsize: CFIndex,
783 hint: CFOptionFlags,
784 ) -> *mut c_void;
785}
786
787extern "C-unwind" {
788 #[deprecated = "renamed to `CFAllocator::deallocate`"]
789 pub fn CFAllocatorDeallocate(allocator: Option<&CFAllocator>, ptr: *mut c_void);
790}
791
792#[deprecated = "renamed to `CFAllocator::preferred_size_for_size`"]
793#[inline]
794pub extern "C-unwind" fn CFAllocatorGetPreferredSizeForSize(
795 allocator: Option<&CFAllocator>,
796 size: CFIndex,
797 hint: CFOptionFlags,
798) -> CFIndex {
799 extern "C-unwind" {
800 fn CFAllocatorGetPreferredSizeForSize(
801 allocator: Option<&CFAllocator>,
802 size: CFIndex,
803 hint: CFOptionFlags,
804 ) -> CFIndex;
805 }
806 unsafe { CFAllocatorGetPreferredSizeForSize(allocator, size, hint) }
807}
808
809extern "C-unwind" {
810 #[deprecated = "renamed to `CFAllocator::context`"]
811 pub fn CFAllocatorGetContext(allocator: Option<&CFAllocator>, context: *mut CFAllocatorContext);
812}