objc2_core_foundation/generated/
CFBinaryHeap.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use 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
12/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfbinaryheapcomparecontext?language=objc)
13#[repr(C)]
14#[allow(unpredictable_function_pointer_comparisons)]
15#[derive(Clone, Copy, Debug, PartialEq)]
16pub struct CFBinaryHeapCompareContext {
17    pub version: CFIndex,
18    pub info: *mut c_void,
19    pub retain: Option<unsafe extern "C-unwind" fn(*const c_void) -> *const c_void>,
20    pub release: Option<unsafe extern "C-unwind" fn(*const c_void)>,
21    pub copyDescription: Option<unsafe extern "C-unwind" fn(*const c_void) -> *const CFString>,
22}
23
24#[cfg(feature = "objc2")]
25unsafe impl Encode for CFBinaryHeapCompareContext {
26    const ENCODING: Encoding = Encoding::Struct(
27        "?",
28        &[
29            <CFIndex>::ENCODING,
30            <*mut c_void>::ENCODING,
31            <Option<unsafe extern "C-unwind" fn(*const c_void) -> *const c_void>>::ENCODING,
32            <Option<unsafe extern "C-unwind" fn(*const c_void)>>::ENCODING,
33            <Option<unsafe extern "C-unwind" fn(*const c_void) -> *const CFString>>::ENCODING,
34        ],
35    );
36}
37
38#[cfg(feature = "objc2")]
39unsafe impl RefEncode for CFBinaryHeapCompareContext {
40    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
41}
42
43/// Structure containing the callbacks for values of a CFBinaryHeap.
44/// Field: version The version number of the structure type being passed
45/// in as a parameter to the CFBinaryHeap creation functions.
46/// This structure is version 0.
47/// Field: retain The callback used to add a retain for the binary heap
48/// on values as they are put into the binary heap.
49/// This callback returns the value to use as the value in the
50/// binary heap, which is usually the value parameter passed to
51/// this callback, but may be a different value if a different
52/// value should be added to the binary heap. The binary heap's
53/// allocator is passed as the first argument.
54/// Field: release The callback used to remove a retain previously added
55/// for the binary heap from values as they are removed from
56/// the binary heap. The binary heap's allocator is passed as the
57/// first argument.
58/// Field: copyDescription The callback used to create a descriptive
59/// string representation of each value in the binary heap. This
60/// is used by the CFCopyDescription() function.
61/// Field: compare The callback used to compare values in the binary heap for
62/// equality in some operations.
63///
64/// See also [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfbinaryheapcallbacks?language=objc)
65#[repr(C)]
66#[allow(unpredictable_function_pointer_comparisons)]
67#[derive(Clone, Copy, Debug, PartialEq)]
68pub struct CFBinaryHeapCallBacks {
69    pub version: CFIndex,
70    pub retain:
71        Option<unsafe extern "C-unwind" fn(*const CFAllocator, *const c_void) -> *const c_void>,
72    pub release: Option<unsafe extern "C-unwind" fn(*const CFAllocator, *const c_void)>,
73    pub copyDescription: Option<unsafe extern "C-unwind" fn(*const c_void) -> *const CFString>,
74    pub compare: Option<
75        unsafe extern "C-unwind" fn(
76            *const c_void,
77            *const c_void,
78            *mut c_void,
79        ) -> CFComparisonResult,
80    >,
81}
82
83#[cfg(feature = "objc2")]
84unsafe impl Encode for CFBinaryHeapCallBacks {
85    const ENCODING: Encoding =
86        Encoding::Struct(
87            "?",
88            &[
89                <CFIndex>::ENCODING,
90                <Option<
91                    unsafe extern "C-unwind" fn(*const CFAllocator, *const c_void) -> *const c_void,
92                >>::ENCODING,
93                <Option<unsafe extern "C-unwind" fn(*const CFAllocator, *const c_void)>>::ENCODING,
94                <Option<unsafe extern "C-unwind" fn(*const c_void) -> *const CFString>>::ENCODING,
95                <Option<
96                    unsafe extern "C-unwind" fn(
97                        *const c_void,
98                        *const c_void,
99                        *mut c_void,
100                    ) -> CFComparisonResult,
101                >>::ENCODING,
102            ],
103        );
104}
105
106#[cfg(feature = "objc2")]
107unsafe impl RefEncode for CFBinaryHeapCallBacks {
108    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
109}
110
111extern "C" {
112    /// Predefined CFBinaryHeapCallBacks structure containing a set
113    /// of callbacks appropriate for use when the values in a CFBinaryHeap
114    /// are all CFString types.
115    ///
116    /// See also [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfstringbinaryheapcallbacks?language=objc)
117    pub static kCFStringBinaryHeapCallBacks: CFBinaryHeapCallBacks;
118}
119
120/// Type of the callback function used by the apply functions of
121/// CFBinaryHeap.
122///
123/// Parameter `val`: The current value from the binary heap.
124///
125/// Parameter `context`: The user-defined context parameter given to the apply
126/// function.
127///
128/// See also [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfbinaryheapapplierfunction?language=objc)
129pub type CFBinaryHeapApplierFunction =
130    Option<unsafe extern "C-unwind" fn(*const c_void, *mut c_void)>;
131
132/// This is the type of a reference to CFBinaryHeaps.
133///
134/// See also [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfbinaryheap?language=objc)
135#[doc(alias = "CFBinaryHeapRef")]
136#[repr(C)]
137pub struct CFBinaryHeap<T: ?Sized = Opaque> {
138    inner: [u8; 0],
139    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
140    _generics: PhantomData<(*mut T,)>,
141}
142
143cf_type!(
144    unsafe impl<T: ?Sized> CFBinaryHeap<T> {}
145);
146#[cfg(feature = "objc2")]
147cf_objc2_type!(
148    unsafe impl<T: ?Sized> RefEncode<"__CFBinaryHeap"> for CFBinaryHeap<T> {}
149);
150
151impl<T: ?Sized> CFBinaryHeap<T> {
152    /// Unchecked conversion of the generic parameter.
153    ///
154    /// # Safety
155    ///
156    /// The generic must be valid to reinterpret as the given type.
157    #[inline]
158    pub unsafe fn cast_unchecked<NewT: ?Sized>(&self) -> &CFBinaryHeap<NewT> {
159        unsafe { &*((self as *const Self).cast()) }
160    }
161
162    /// Convert to the opaque/untyped variant.
163    #[inline]
164    pub fn as_opaque(&self) -> &CFBinaryHeap {
165        unsafe { self.cast_unchecked() }
166    }
167}
168
169unsafe impl ConcreteType for CFBinaryHeap {
170    /// Returns the type identifier of all CFBinaryHeap instances.
171    #[doc(alias = "CFBinaryHeapGetTypeID")]
172    #[inline]
173    fn type_id() -> CFTypeID {
174        extern "C-unwind" {
175            fn CFBinaryHeapGetTypeID() -> CFTypeID;
176        }
177        unsafe { CFBinaryHeapGetTypeID() }
178    }
179}
180
181impl CFBinaryHeap {
182    /// Creates a new mutable binary heap with the given values.
183    ///
184    /// Parameter `allocator`: The CFAllocator which should be used to allocate
185    /// memory for the binary heap and its storage for values. This
186    /// parameter may be NULL in which case the current default
187    /// CFAllocator is used. If this reference is not a valid
188    /// CFAllocator, the behavior is undefined.
189    ///
190    /// Parameter `capacity`: A hint about the number of values that will be held
191    /// by the CFBinaryHeap. Pass 0 for no hint. The implementation may
192    /// ignore this hint, or may use it to optimize various
193    /// operations. A heap's actual capacity is only limited by
194    /// address space and available memory constraints). If this
195    /// parameter is negative, the behavior is undefined.
196    ///
197    /// Parameter `callBacks`: A pointer to a CFBinaryHeapCallBacks structure
198    /// initialized with the callbacks for the binary heap to use on
199    /// each value in the binary heap. A copy of the contents of the
200    /// callbacks structure is made, so that a pointer to a structure
201    /// on the stack can be passed in, or can be reused for multiple
202    /// binary heap creations. If the version field of this callbacks
203    /// structure is not one of the defined ones for CFBinaryHeap, the
204    /// behavior is undefined. The retain field may be NULL, in which
205    /// case the CFBinaryHeap will do nothing to add a retain to values
206    /// as they are put into the binary heap. The release field may be
207    /// NULL, in which case the CFBinaryHeap will do nothing to remove
208    /// the binary heap's retain (if any) on the values when the
209    /// heap is destroyed or a key-value pair is removed. If the
210    /// copyDescription field is NULL, the binary heap will create a
211    /// simple description for a value. If the equal field is NULL, the
212    /// binary heap will use pointer equality to test for equality of
213    /// values. This callbacks parameter itself may be NULL, which is
214    /// treated as if a valid structure of version 0 with all fields
215    /// NULL had been passed in. Otherwise,
216    /// if any of the fields are not valid pointers to functions
217    /// of the correct type, or this parameter is not a valid
218    /// pointer to a CFBinaryHeapCallBacks callbacks structure,
219    /// the behavior is undefined. If any of the values put into the
220    /// binary heap is not one understood by one of the callback functions
221    /// the behavior when that callback function is used is undefined.
222    ///
223    /// Parameter `compareContext`: A pointer to a CFBinaryHeapCompareContext structure.
224    ///
225    /// Returns: A reference to the new CFBinaryHeap.
226    ///
227    /// # Safety
228    ///
229    /// - `allocator` might not allow `None`.
230    /// - `call_backs` must be a valid pointer.
231    /// - `compare_context` must be a valid pointer.
232    #[doc(alias = "CFBinaryHeapCreate")]
233    #[inline]
234    pub unsafe fn new(
235        allocator: Option<&CFAllocator>,
236        capacity: CFIndex,
237        call_backs: *const CFBinaryHeapCallBacks,
238        compare_context: *const CFBinaryHeapCompareContext,
239    ) -> Option<CFRetained<CFBinaryHeap>> {
240        extern "C-unwind" {
241            fn CFBinaryHeapCreate(
242                allocator: Option<&CFAllocator>,
243                capacity: CFIndex,
244                call_backs: *const CFBinaryHeapCallBacks,
245                compare_context: *const CFBinaryHeapCompareContext,
246            ) -> Option<NonNull<CFBinaryHeap>>;
247        }
248        let ret = unsafe { CFBinaryHeapCreate(allocator, capacity, call_backs, compare_context) };
249        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
250    }
251
252    /// Creates a new mutable binary heap with the values from the given binary heap.
253    ///
254    /// Parameter `allocator`: The CFAllocator which should be used to allocate
255    /// memory for the binary heap and its storage for values. This
256    /// parameter may be NULL in which case the current default
257    /// CFAllocator is used. If this reference is not a valid
258    /// CFAllocator, the behavior is undefined.
259    ///
260    /// Parameter `capacity`: A hint about the number of values that will be held
261    /// by the CFBinaryHeap. Pass 0 for no hint. The implementation may
262    /// ignore this hint, or may use it to optimize various
263    /// operations. A heap's actual capacity is only limited by
264    /// address space and available memory constraints).
265    /// This parameter must be greater than or equal
266    /// to the count of the heap which is to be copied, or the
267    /// behavior is undefined. If this parameter is negative, the
268    /// behavior is undefined.
269    ///
270    /// Parameter `heap`: The binary heap which is to be copied. The values from the
271    /// binary heap are copied as pointers into the new binary heap (that is,
272    /// the values themselves are copied, not that which the values
273    /// point to, if anything). However, the values are also
274    /// retained by the new binary heap. The count of the new binary will
275    /// be the same as the given binary heap. The new binary heap uses the same
276    /// callbacks as the binary heap to be copied. If this parameter is
277    /// not a valid CFBinaryHeap, the behavior is undefined.
278    ///
279    /// Returns: A reference to the new mutable binary heap.
280    ///
281    /// # Safety
282    ///
283    /// - `allocator` might not allow `None`.
284    /// - `heap` generic must be of the correct type.
285    /// - `heap` might not allow `None`.
286    #[doc(alias = "CFBinaryHeapCreateCopy")]
287    #[inline]
288    pub unsafe fn new_copy(
289        allocator: Option<&CFAllocator>,
290        capacity: CFIndex,
291        heap: Option<&CFBinaryHeap>,
292    ) -> Option<CFRetained<CFBinaryHeap>> {
293        extern "C-unwind" {
294            fn CFBinaryHeapCreateCopy(
295                allocator: Option<&CFAllocator>,
296                capacity: CFIndex,
297                heap: Option<&CFBinaryHeap>,
298            ) -> Option<NonNull<CFBinaryHeap>>;
299        }
300        let ret = unsafe { CFBinaryHeapCreateCopy(allocator, capacity, heap) };
301        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
302    }
303
304    /// Returns the number of values currently in the binary heap.
305    ///
306    /// Parameter `heap`: The binary heap to be queried. If this parameter is not a valid
307    /// CFBinaryHeap, the behavior is undefined.
308    ///
309    /// Returns: The number of values in the binary heap.
310    ///
311    /// # Safety
312    ///
313    /// `heap` generic must be of the correct type.
314    #[doc(alias = "CFBinaryHeapGetCount")]
315    #[inline]
316    pub unsafe fn count(&self) -> CFIndex {
317        extern "C-unwind" {
318            fn CFBinaryHeapGetCount(heap: &CFBinaryHeap) -> CFIndex;
319        }
320        unsafe { CFBinaryHeapGetCount(self) }
321    }
322
323    /// Counts the number of times the given value occurs in the binary heap.
324    ///
325    /// Parameter `heap`: The binary heap to be searched. If this parameter is not a
326    /// valid CFBinaryHeap, the behavior is undefined.
327    ///
328    /// Parameter `value`: The value for which to find matches in the binary heap. The
329    /// compare() callback provided when the binary heap was created is
330    /// used to compare. If the compare() callback was NULL, pointer
331    /// equality (in C, ==) is used. If value, or any of the values
332    /// in the binary heap, are not understood by the compare() callback,
333    /// the behavior is undefined.
334    ///
335    /// Returns: The number of times the given value occurs in the binary heap.
336    ///
337    /// # Safety
338    ///
339    /// - `heap` generic must be of the correct type.
340    /// - `value` must be a valid pointer.
341    #[doc(alias = "CFBinaryHeapGetCountOfValue")]
342    #[inline]
343    pub unsafe fn count_of_value(&self, value: *const c_void) -> CFIndex {
344        extern "C-unwind" {
345            fn CFBinaryHeapGetCountOfValue(heap: &CFBinaryHeap, value: *const c_void) -> CFIndex;
346        }
347        unsafe { CFBinaryHeapGetCountOfValue(self, value) }
348    }
349
350    /// Reports whether or not the value is in the binary heap.
351    ///
352    /// Parameter `heap`: The binary heap to be searched. If this parameter is not a
353    /// valid CFBinaryHeap, the behavior is undefined.
354    ///
355    /// Parameter `value`: The value for which to find matches in the binary heap. The
356    /// compare() callback provided when the binary heap was created is
357    /// used to compare. If the compare() callback was NULL, pointer
358    /// equality (in C, ==) is used. If value, or any of the values
359    /// in the binary heap, are not understood by the compare() callback,
360    /// the behavior is undefined.
361    ///
362    /// Returns: true, if the value is in the specified binary heap, otherwise false.
363    ///
364    /// # Safety
365    ///
366    /// - `heap` generic must be of the correct type.
367    /// - `value` must be a valid pointer.
368    #[doc(alias = "CFBinaryHeapContainsValue")]
369    #[inline]
370    pub unsafe fn contains_value(&self, value: *const c_void) -> bool {
371        extern "C-unwind" {
372            fn CFBinaryHeapContainsValue(heap: &CFBinaryHeap, value: *const c_void) -> Boolean;
373        }
374        let ret = unsafe { CFBinaryHeapContainsValue(self, value) };
375        ret != 0
376    }
377
378    /// Returns the minimum value is in the binary heap.  If the heap contains several equal
379    /// minimum values, any one may be returned.
380    ///
381    /// Parameter `heap`: The binary heap to be searched. If this parameter is not a
382    /// valid CFBinaryHeap, the behavior is undefined.
383    ///
384    /// Returns: A reference to the minimum value in the binary heap, or NULL if the
385    /// binary heap contains no values.
386    ///
387    /// # Safety
388    ///
389    /// `heap` generic must be of the correct type.
390    #[doc(alias = "CFBinaryHeapGetMinimum")]
391    #[inline]
392    pub unsafe fn minimum(&self) -> *const c_void {
393        extern "C-unwind" {
394            fn CFBinaryHeapGetMinimum(heap: &CFBinaryHeap) -> *const c_void;
395        }
396        unsafe { CFBinaryHeapGetMinimum(self) }
397    }
398
399    /// Returns the minimum value is in the binary heap, if present.  If the heap contains several equal
400    /// minimum values, any one may be returned.
401    ///
402    /// Parameter `heap`: The binary heap to be searched. If this parameter is not a
403    /// valid CFBinaryHeap, the behavior is undefined.
404    ///
405    /// Parameter `value`: A C pointer to pointer-sized storage to be filled with the minimum value in
406    /// the binary heap.  If this value is not a valid C pointer to a pointer-sized block
407    /// of storage, the result is undefined.  If the result of the function is false, the value
408    /// stored at this address is undefined.
409    ///
410    /// Returns: true, if a minimum value was found in the specified binary heap, otherwise false.
411    ///
412    /// # Safety
413    ///
414    /// - `heap` generic must be of the correct type.
415    /// - `value` must be a valid pointer.
416    #[doc(alias = "CFBinaryHeapGetMinimumIfPresent")]
417    #[inline]
418    pub unsafe fn minimum_if_present(&self, value: *mut *const c_void) -> bool {
419        extern "C-unwind" {
420            fn CFBinaryHeapGetMinimumIfPresent(
421                heap: &CFBinaryHeap,
422                value: *mut *const c_void,
423            ) -> Boolean;
424        }
425        let ret = unsafe { CFBinaryHeapGetMinimumIfPresent(self, value) };
426        ret != 0
427    }
428
429    /// Fills the buffer with values from the binary heap.
430    ///
431    /// Parameter `heap`: The binary heap to be queried. If this parameter is not a
432    /// valid CFBinaryHeap, the behavior is undefined.
433    ///
434    /// Parameter `values`: A C array of pointer-sized values to be filled with
435    /// values from the binary heap. The values in the C array are ordered
436    /// from least to greatest. If this parameter is not a valid pointer to a
437    /// C array of at least CFBinaryHeapGetCount() pointers, the behavior is undefined.
438    ///
439    /// # Safety
440    ///
441    /// - `heap` generic must be of the correct type.
442    /// - `values` must be a valid pointer.
443    #[doc(alias = "CFBinaryHeapGetValues")]
444    #[inline]
445    pub unsafe fn values(&self, values: *mut *const c_void) {
446        extern "C-unwind" {
447            fn CFBinaryHeapGetValues(heap: &CFBinaryHeap, values: *mut *const c_void);
448        }
449        unsafe { CFBinaryHeapGetValues(self, values) }
450    }
451
452    /// Calls a function once for each value in the binary heap.
453    ///
454    /// Parameter `heap`: The binary heap to be operated upon. If this parameter is not a
455    /// valid CFBinaryHeap, the behavior is undefined.
456    ///
457    /// Parameter `applier`: The callback function to call once for each value in
458    /// the given binary heap. If this parameter is not a
459    /// pointer to a function of the correct prototype, the behavior
460    /// is undefined. If there are values in the binary heap which the
461    /// applier function does not expect or cannot properly apply
462    /// to, the behavior is undefined.
463    ///
464    /// Parameter `context`: A pointer-sized user-defined value, which is passed
465    /// as the second parameter to the applier function, but is
466    /// otherwise unused by this function. If the context is not
467    /// what is expected by the applier function, the behavior is
468    /// undefined.
469    ///
470    /// # Safety
471    ///
472    /// - `heap` generic must be of the correct type.
473    /// - `applier` must be implemented correctly.
474    /// - `context` must be a valid pointer.
475    #[doc(alias = "CFBinaryHeapApplyFunction")]
476    #[inline]
477    pub unsafe fn apply_function(
478        &self,
479        applier: CFBinaryHeapApplierFunction,
480        context: *mut c_void,
481    ) {
482        extern "C-unwind" {
483            fn CFBinaryHeapApplyFunction(
484                heap: &CFBinaryHeap,
485                applier: CFBinaryHeapApplierFunction,
486                context: *mut c_void,
487            );
488        }
489        unsafe { CFBinaryHeapApplyFunction(self, applier, context) }
490    }
491
492    /// Adds the value to the binary heap.
493    ///
494    /// Parameter `heap`: The binary heap to which the value is to be added. If this parameter is not a
495    /// valid mutable CFBinaryHeap, the behavior is undefined.
496    ///
497    /// Parameter `value`: The value to add to the binary heap. The value is retained by
498    /// the binary heap using the retain callback provided when the binary heap
499    /// was created. If the value is not of the sort expected by the
500    /// retain callback, the behavior is undefined.
501    ///
502    /// # Safety
503    ///
504    /// - `heap` generic must be of the correct type.
505    /// - `value` must be a valid pointer.
506    #[doc(alias = "CFBinaryHeapAddValue")]
507    #[inline]
508    pub unsafe fn add_value(&self, value: *const c_void) {
509        extern "C-unwind" {
510            fn CFBinaryHeapAddValue(heap: &CFBinaryHeap, value: *const c_void);
511        }
512        unsafe { CFBinaryHeapAddValue(self, value) }
513    }
514
515    /// Removes the minimum value from the binary heap.
516    ///
517    /// Parameter `heap`: The binary heap from which the minimum value is to be removed. If this
518    /// parameter is not a valid mutable CFBinaryHeap, the behavior is undefined.
519    ///
520    /// # Safety
521    ///
522    /// `heap` generic must be of the correct type.
523    #[doc(alias = "CFBinaryHeapRemoveMinimumValue")]
524    #[inline]
525    pub unsafe fn remove_minimum_value(&self) {
526        extern "C-unwind" {
527            fn CFBinaryHeapRemoveMinimumValue(heap: &CFBinaryHeap);
528        }
529        unsafe { CFBinaryHeapRemoveMinimumValue(self) }
530    }
531
532    /// Removes all the values from the binary heap, making it empty.
533    ///
534    /// Parameter `heap`: The binary heap from which all of the values are to be
535    /// removed. If this parameter is not a valid mutable CFBinaryHeap,
536    /// the behavior is undefined.
537    ///
538    /// # Safety
539    ///
540    /// `heap` generic must be of the correct type.
541    #[doc(alias = "CFBinaryHeapRemoveAllValues")]
542    #[inline]
543    pub unsafe fn remove_all_values(&self) {
544        extern "C-unwind" {
545            fn CFBinaryHeapRemoveAllValues(heap: &CFBinaryHeap);
546        }
547        unsafe { CFBinaryHeapRemoveAllValues(self) }
548    }
549}
550
551#[deprecated = "renamed to `CFBinaryHeap::new`"]
552#[inline]
553pub unsafe extern "C-unwind" fn CFBinaryHeapCreate(
554    allocator: Option<&CFAllocator>,
555    capacity: CFIndex,
556    call_backs: *const CFBinaryHeapCallBacks,
557    compare_context: *const CFBinaryHeapCompareContext,
558) -> Option<CFRetained<CFBinaryHeap>> {
559    extern "C-unwind" {
560        fn CFBinaryHeapCreate(
561            allocator: Option<&CFAllocator>,
562            capacity: CFIndex,
563            call_backs: *const CFBinaryHeapCallBacks,
564            compare_context: *const CFBinaryHeapCompareContext,
565        ) -> Option<NonNull<CFBinaryHeap>>;
566    }
567    let ret = unsafe { CFBinaryHeapCreate(allocator, capacity, call_backs, compare_context) };
568    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
569}
570
571#[deprecated = "renamed to `CFBinaryHeap::new_copy`"]
572#[inline]
573pub unsafe extern "C-unwind" fn CFBinaryHeapCreateCopy(
574    allocator: Option<&CFAllocator>,
575    capacity: CFIndex,
576    heap: Option<&CFBinaryHeap>,
577) -> Option<CFRetained<CFBinaryHeap>> {
578    extern "C-unwind" {
579        fn CFBinaryHeapCreateCopy(
580            allocator: Option<&CFAllocator>,
581            capacity: CFIndex,
582            heap: Option<&CFBinaryHeap>,
583        ) -> Option<NonNull<CFBinaryHeap>>;
584    }
585    let ret = unsafe { CFBinaryHeapCreateCopy(allocator, capacity, heap) };
586    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
587}
588
589extern "C-unwind" {
590    #[deprecated = "renamed to `CFBinaryHeap::count`"]
591    pub fn CFBinaryHeapGetCount(heap: &CFBinaryHeap) -> CFIndex;
592}
593
594extern "C-unwind" {
595    #[deprecated = "renamed to `CFBinaryHeap::count_of_value`"]
596    pub fn CFBinaryHeapGetCountOfValue(heap: &CFBinaryHeap, value: *const c_void) -> CFIndex;
597}
598
599#[deprecated = "renamed to `CFBinaryHeap::contains_value`"]
600#[inline]
601pub unsafe extern "C-unwind" fn CFBinaryHeapContainsValue(
602    heap: &CFBinaryHeap,
603    value: *const c_void,
604) -> bool {
605    extern "C-unwind" {
606        fn CFBinaryHeapContainsValue(heap: &CFBinaryHeap, value: *const c_void) -> Boolean;
607    }
608    let ret = unsafe { CFBinaryHeapContainsValue(heap, value) };
609    ret != 0
610}
611
612extern "C-unwind" {
613    #[deprecated = "renamed to `CFBinaryHeap::minimum`"]
614    pub fn CFBinaryHeapGetMinimum(heap: &CFBinaryHeap) -> *const c_void;
615}
616
617#[deprecated = "renamed to `CFBinaryHeap::minimum_if_present`"]
618#[inline]
619pub unsafe extern "C-unwind" fn CFBinaryHeapGetMinimumIfPresent(
620    heap: &CFBinaryHeap,
621    value: *mut *const c_void,
622) -> bool {
623    extern "C-unwind" {
624        fn CFBinaryHeapGetMinimumIfPresent(
625            heap: &CFBinaryHeap,
626            value: *mut *const c_void,
627        ) -> Boolean;
628    }
629    let ret = unsafe { CFBinaryHeapGetMinimumIfPresent(heap, value) };
630    ret != 0
631}
632
633extern "C-unwind" {
634    #[deprecated = "renamed to `CFBinaryHeap::values`"]
635    pub fn CFBinaryHeapGetValues(heap: &CFBinaryHeap, values: *mut *const c_void);
636}
637
638extern "C-unwind" {
639    #[deprecated = "renamed to `CFBinaryHeap::apply_function`"]
640    pub fn CFBinaryHeapApplyFunction(
641        heap: &CFBinaryHeap,
642        applier: CFBinaryHeapApplierFunction,
643        context: *mut c_void,
644    );
645}
646
647extern "C-unwind" {
648    #[deprecated = "renamed to `CFBinaryHeap::add_value`"]
649    pub fn CFBinaryHeapAddValue(heap: &CFBinaryHeap, value: *const c_void);
650}
651
652extern "C-unwind" {
653    #[deprecated = "renamed to `CFBinaryHeap::remove_minimum_value`"]
654    pub fn CFBinaryHeapRemoveMinimumValue(heap: &CFBinaryHeap);
655}
656
657extern "C-unwind" {
658    #[deprecated = "renamed to `CFBinaryHeap::remove_all_values`"]
659    pub fn CFBinaryHeapRemoveAllValues(heap: &CFBinaryHeap);
660}