objc2_core_foundation/generated/CFTree.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/// Type of the callback function used to add a retain to the user-specified
13/// info parameter. This callback may returns the value to use whenever the
14/// info parameter is retained, which is usually the value parameter passed
15/// to this callback, but may be a different value if a different value
16/// should be used.
17///
18/// Parameter `info`: A user-supplied info parameter provided in a CFTreeContext.
19///
20/// Returns: The retained info parameter.
21///
22/// See also [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cftreeretaincallback?language=objc)
23pub type CFTreeRetainCallBack = Option<unsafe extern "C-unwind" fn(*const c_void) -> *const c_void>;
24
25/// Type of the callback function used to remove a retain previously
26/// added to the user-specified info parameter.
27///
28/// Parameter `info`: A user-supplied info parameter provided in a CFTreeContext.
29///
30/// See also [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cftreereleasecallback?language=objc)
31pub type CFTreeReleaseCallBack = Option<unsafe extern "C-unwind" fn(*const c_void)>;
32
33/// Type of the callback function used to provide a description of the
34/// user-specified info parameter.
35///
36/// Parameter `info`: A user-supplied info parameter provided in a CFTreeContext.
37///
38/// Returns: A description of the info parameter.
39///
40/// See also [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cftreecopydescriptioncallback?language=objc)
41pub type CFTreeCopyDescriptionCallBack =
42 Option<unsafe extern "C-unwind" fn(*const c_void) -> *const CFString>;
43
44/// Structure containing user-specified data and callbacks for a CFTree.
45/// Field: version The version number of the structure type being passed
46/// in as a parameter to the CFTree creation function.
47/// This structure is version 0.
48/// Field: info A C pointer to a user-specified block of data.
49/// Field: retain The callback used to add a retain for the info field.
50/// If this parameter is not a pointer to a function of the correct
51/// prototype, the behavior is undefined. The value may be NULL.
52/// Field: release The calllback used to remove a retain previously added
53/// for the info field. If this parameter is not a pointer to a
54/// function of the correct prototype, the behavior is undefined.
55/// The value may be NULL.
56/// Field: copyDescription The callback used to provide a description of
57/// the info field.
58///
59/// See also [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cftreecontext?language=objc)
60#[repr(C)]
61#[allow(unpredictable_function_pointer_comparisons)]
62#[derive(Clone, Copy, Debug, PartialEq)]
63pub struct CFTreeContext {
64 pub version: CFIndex,
65 pub info: *mut c_void,
66 pub retain: CFTreeRetainCallBack,
67 pub release: CFTreeReleaseCallBack,
68 pub copyDescription: CFTreeCopyDescriptionCallBack,
69}
70
71#[cfg(feature = "objc2")]
72unsafe impl Encode for CFTreeContext {
73 const ENCODING: Encoding = Encoding::Struct(
74 "?",
75 &[
76 <CFIndex>::ENCODING,
77 <*mut c_void>::ENCODING,
78 <CFTreeRetainCallBack>::ENCODING,
79 <CFTreeReleaseCallBack>::ENCODING,
80 <CFTreeCopyDescriptionCallBack>::ENCODING,
81 ],
82 );
83}
84
85#[cfg(feature = "objc2")]
86unsafe impl RefEncode for CFTreeContext {
87 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
88}
89
90/// Type of the callback function used by the apply functions of
91/// CFTree.
92///
93/// Parameter `value`: The current value from the CFTree
94///
95/// Parameter `context`: The user-defined context parameter give to the apply
96/// function.
97///
98/// See also [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cftreeapplierfunction?language=objc)
99pub type CFTreeApplierFunction = Option<unsafe extern "C-unwind" fn(*const c_void, *mut c_void)>;
100
101/// This is the type of a reference to CFTrees.
102///
103/// See also [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cftree?language=objc)
104#[doc(alias = "CFTreeRef")]
105#[repr(C)]
106pub struct CFTree {
107 inner: [u8; 0],
108 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
109}
110
111cf_type!(
112 unsafe impl CFTree {}
113);
114#[cfg(feature = "objc2")]
115cf_objc2_type!(
116 unsafe impl RefEncode<"__CFTree"> for CFTree {}
117);
118
119unsafe impl ConcreteType for CFTree {
120 /// Returns the type identifier of all CFTree instances.
121 #[doc(alias = "CFTreeGetTypeID")]
122 #[inline]
123 fn type_id() -> CFTypeID {
124 extern "C-unwind" {
125 fn CFTreeGetTypeID() -> CFTypeID;
126 }
127 unsafe { CFTreeGetTypeID() }
128 }
129}
130
131impl CFTree {
132 /// Creates a new mutable tree.
133 ///
134 /// Parameter `allocator`: The CFAllocator which should be used to allocate
135 /// memory for the tree and storage for its children. This
136 /// parameter may be NULL in which case the current default
137 /// CFAllocator is used. If this reference is not a valid
138 /// CFAllocator, the behavior is undefined.
139 ///
140 /// Parameter `context`: A C pointer to a CFTreeContext structure to be copied
141 /// and used as the context of the new tree. The info parameter
142 /// will be retained by the tree if a retain function is provided.
143 /// If this value is not a valid C pointer to a CFTreeContext
144 /// structure-sized block of storage, the result is undefined.
145 /// If the version number of the storage is not a valid CFTreeContext
146 /// version number, the result is undefined.
147 ///
148 /// Returns: A reference to the new CFTree.
149 ///
150 /// # Safety
151 ///
152 /// - `allocator` might not allow `None`.
153 /// - `context` must be a valid pointer.
154 #[doc(alias = "CFTreeCreate")]
155 #[inline]
156 pub unsafe fn new(
157 allocator: Option<&CFAllocator>,
158 context: *const CFTreeContext,
159 ) -> Option<CFRetained<CFTree>> {
160 extern "C-unwind" {
161 fn CFTreeCreate(
162 allocator: Option<&CFAllocator>,
163 context: *const CFTreeContext,
164 ) -> Option<NonNull<CFTree>>;
165 }
166 let ret = unsafe { CFTreeCreate(allocator, context) };
167 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
168 }
169
170 /// Returns the parent of the specified tree.
171 ///
172 /// Parameter `tree`: The tree to be queried. If this parameter is not a valid
173 /// CFTree, the behavior is undefined.
174 ///
175 /// Returns: The parent of the tree.
176 #[doc(alias = "CFTreeGetParent")]
177 #[inline]
178 pub fn parent(&self) -> Option<CFRetained<CFTree>> {
179 extern "C-unwind" {
180 fn CFTreeGetParent(tree: &CFTree) -> Option<NonNull<CFTree>>;
181 }
182 let ret = unsafe { CFTreeGetParent(self) };
183 ret.map(|ret| unsafe { CFRetained::retain(ret) })
184 }
185
186 /// Returns the sibling after the specified tree in the parent tree's list.
187 ///
188 /// Parameter `tree`: The tree to be queried. If this parameter is not a valid
189 /// CFTree, the behavior is undefined.
190 ///
191 /// Returns: The next sibling of the tree.
192 #[doc(alias = "CFTreeGetNextSibling")]
193 #[inline]
194 pub fn next_sibling(&self) -> Option<CFRetained<CFTree>> {
195 extern "C-unwind" {
196 fn CFTreeGetNextSibling(tree: &CFTree) -> Option<NonNull<CFTree>>;
197 }
198 let ret = unsafe { CFTreeGetNextSibling(self) };
199 ret.map(|ret| unsafe { CFRetained::retain(ret) })
200 }
201
202 /// Returns the first child of the tree.
203 ///
204 /// Parameter `tree`: The tree to be queried. If this parameter is not a valid
205 /// CFTree, the behavior is undefined.
206 ///
207 /// Returns: The first child of the tree.
208 #[doc(alias = "CFTreeGetFirstChild")]
209 #[inline]
210 pub fn first_child(&self) -> Option<CFRetained<CFTree>> {
211 extern "C-unwind" {
212 fn CFTreeGetFirstChild(tree: &CFTree) -> Option<NonNull<CFTree>>;
213 }
214 let ret = unsafe { CFTreeGetFirstChild(self) };
215 ret.map(|ret| unsafe { CFRetained::retain(ret) })
216 }
217
218 /// Returns the context of the specified tree.
219 ///
220 /// Parameter `tree`: The tree to be queried. If this parameter is not a valid
221 /// CFTree, the behavior is undefined.
222 ///
223 /// Parameter `context`: A C pointer to a CFTreeContext structure to be filled in with
224 /// the context of the specified tree. If this value is not a valid C
225 /// pointer to a CFTreeContext structure-sized block of storage, the
226 /// result is undefined. If the version number of the storage is not
227 /// a valid CFTreeContext version number, the result is undefined.
228 ///
229 /// # Safety
230 ///
231 /// `context` must be a valid pointer.
232 #[doc(alias = "CFTreeGetContext")]
233 #[inline]
234 pub unsafe fn context(&self, context: *mut CFTreeContext) {
235 extern "C-unwind" {
236 fn CFTreeGetContext(tree: &CFTree, context: *mut CFTreeContext);
237 }
238 unsafe { CFTreeGetContext(self, context) }
239 }
240
241 /// Returns the number of children of the specified tree.
242 ///
243 /// Parameter `tree`: The tree to be queried. If this parameter is not a valid
244 /// CFTree, the behavior is undefined.
245 ///
246 /// Returns: The number of children.
247 #[doc(alias = "CFTreeGetChildCount")]
248 #[inline]
249 pub fn child_count(&self) -> CFIndex {
250 extern "C-unwind" {
251 fn CFTreeGetChildCount(tree: &CFTree) -> CFIndex;
252 }
253 unsafe { CFTreeGetChildCount(self) }
254 }
255
256 /// Returns the nth child of the specified tree.
257 ///
258 /// Parameter `tree`: The tree to be queried. If this parameter is not a valid
259 /// CFTree, the behavior is undefined.
260 ///
261 /// Parameter `idx`: The index of the child tree to be returned. If this parameter
262 /// is less than zero or greater than the number of children of the
263 /// tree, the result is undefined.
264 ///
265 /// Returns: A reference to the specified child tree.
266 #[doc(alias = "CFTreeGetChildAtIndex")]
267 #[inline]
268 pub fn child_at_index(&self, idx: CFIndex) -> Option<CFRetained<CFTree>> {
269 extern "C-unwind" {
270 fn CFTreeGetChildAtIndex(tree: &CFTree, idx: CFIndex) -> Option<NonNull<CFTree>>;
271 }
272 let ret = unsafe { CFTreeGetChildAtIndex(self, idx) };
273 ret.map(|ret| unsafe { CFRetained::retain(ret) })
274 }
275
276 /// Fills the buffer with children from the tree.
277 ///
278 /// Parameter `tree`: The tree to be queried. If this parameter is not a valid
279 /// CFTree, the behavior is undefined.
280 ///
281 /// Parameter `children`: A C array of pointer-sized values to be filled with
282 /// children from the tree. If this parameter is not a valid pointer to a
283 /// C array of at least CFTreeGetChildCount() pointers, the behavior is undefined.
284 ///
285 /// # Safety
286 ///
287 /// `children` must be a valid pointer.
288 #[doc(alias = "CFTreeGetChildren")]
289 #[inline]
290 pub unsafe fn children(&self, children: *mut *mut CFTree) {
291 extern "C-unwind" {
292 fn CFTreeGetChildren(tree: &CFTree, children: *mut *mut CFTree);
293 }
294 unsafe { CFTreeGetChildren(self, children) }
295 }
296
297 /// Calls a function once for each child of the tree. Note that the applier
298 /// only operates one level deep, and does not operate on descendents further
299 /// removed than the immediate children of the tree.
300 ///
301 /// Parameter `tree`: The tree to be operated upon. If this parameter is not a
302 /// valid CFTree, the behavior is undefined.
303 ///
304 /// Parameter `applier`: The callback function to call once for each child of
305 /// the given tree. If this parameter is not a pointer to a
306 /// function of the correct prototype, the behavior is undefined.
307 /// If there are values in the tree which the applier function does
308 /// not expect or cannot properly apply to, the behavior is undefined.
309 ///
310 /// Parameter `context`: A pointer-sized user-defined value, which is passed
311 /// as the second parameter to the applier function, but is
312 /// otherwise unused by this function. If the context is not
313 /// what is expected by the applier function, the behavior is
314 /// undefined.
315 ///
316 /// # Safety
317 ///
318 /// - `applier` must be implemented correctly.
319 /// - `context` must be a valid pointer.
320 #[doc(alias = "CFTreeApplyFunctionToChildren")]
321 #[inline]
322 pub unsafe fn apply_function_to_children(
323 &self,
324 applier: CFTreeApplierFunction,
325 context: *mut c_void,
326 ) {
327 extern "C-unwind" {
328 fn CFTreeApplyFunctionToChildren(
329 tree: &CFTree,
330 applier: CFTreeApplierFunction,
331 context: *mut c_void,
332 );
333 }
334 unsafe { CFTreeApplyFunctionToChildren(self, applier, context) }
335 }
336
337 /// Returns the root tree of which the specified tree is a descendent.
338 ///
339 /// Parameter `tree`: The tree to be queried. If this parameter is not a valid
340 /// CFTree, the behavior is undefined.
341 ///
342 /// Returns: A reference to the root of the tree.
343 #[doc(alias = "CFTreeFindRoot")]
344 #[inline]
345 pub fn find_root(&self) -> Option<CFRetained<CFTree>> {
346 extern "C-unwind" {
347 fn CFTreeFindRoot(tree: &CFTree) -> Option<NonNull<CFTree>>;
348 }
349 let ret = unsafe { CFTreeFindRoot(self) };
350 ret.map(|ret| unsafe { CFRetained::retain(ret) })
351 }
352
353 /// Replaces the context of a tree. The tree releases its retain on the
354 /// info of the previous context, and retains the info of the new context.
355 ///
356 /// Parameter `tree`: The tree to be operated on. If this parameter is not a valid
357 /// CFTree, the behavior is undefined.
358 ///
359 /// Parameter `context`: A C pointer to a CFTreeContext structure to be copied
360 /// and used as the context of the new tree. The info parameter
361 /// will be retained by the tree if a retain function is provided.
362 /// If this value is not a valid C pointer to a CFTreeContext
363 /// structure-sized block of storage, the result is undefined.
364 /// If the version number of the storage is not a valid CFTreeContext
365 /// version number, the result is undefined.
366 ///
367 /// # Safety
368 ///
369 /// `context` must be a valid pointer.
370 #[doc(alias = "CFTreeSetContext")]
371 #[inline]
372 pub unsafe fn set_context(&self, context: *const CFTreeContext) {
373 extern "C-unwind" {
374 fn CFTreeSetContext(tree: &CFTree, context: *const CFTreeContext);
375 }
376 unsafe { CFTreeSetContext(self, context) }
377 }
378
379 /// Adds the newChild to the specified tree as the first in its list of children.
380 ///
381 /// Parameter `tree`: The tree to be operated on. If this parameter is not a valid
382 /// CFTree, the behavior is undefined.
383 ///
384 /// Parameter `newChild`: The child to be added.
385 /// If this parameter is not a valid CFTree, the behavior is undefined.
386 /// If this parameter is a tree which is already a child of any tree,
387 /// the behavior is undefined.
388 ///
389 /// # Safety
390 ///
391 /// `new_child` might not allow `None`.
392 #[doc(alias = "CFTreePrependChild")]
393 #[inline]
394 pub unsafe fn prepend_child(&self, new_child: Option<&CFTree>) {
395 extern "C-unwind" {
396 fn CFTreePrependChild(tree: &CFTree, new_child: Option<&CFTree>);
397 }
398 unsafe { CFTreePrependChild(self, new_child) }
399 }
400
401 /// Adds the newChild to the specified tree as the last in its list of children.
402 ///
403 /// Parameter `tree`: The tree to be operated on. If this parameter is not a valid
404 /// CFTree, the behavior is undefined.
405 ///
406 /// Parameter `newChild`: The child to be added.
407 /// If this parameter is not a valid CFTree, the behavior is undefined.
408 /// If this parameter is a tree which is already a child of any tree,
409 /// the behavior is undefined.
410 ///
411 /// # Safety
412 ///
413 /// `new_child` might not allow `None`.
414 #[doc(alias = "CFTreeAppendChild")]
415 #[inline]
416 pub unsafe fn append_child(&self, new_child: Option<&CFTree>) {
417 extern "C-unwind" {
418 fn CFTreeAppendChild(tree: &CFTree, new_child: Option<&CFTree>);
419 }
420 unsafe { CFTreeAppendChild(self, new_child) }
421 }
422
423 /// Inserts newSibling into the the parent tree's linked list of children after
424 /// tree. The newSibling will have the same parent as tree.
425 ///
426 /// Parameter `tree`: The tree to insert newSibling after. If this parameter is not a valid
427 /// CFTree, the behavior is undefined. If the tree does not have a
428 /// parent, the behavior is undefined.
429 ///
430 /// Parameter `newSibling`: The sibling to be added.
431 /// If this parameter is not a valid CFTree, the behavior is undefined.
432 /// If this parameter is a tree which is already a child of any tree,
433 /// the behavior is undefined.
434 ///
435 /// # Safety
436 ///
437 /// `new_sibling` might not allow `None`.
438 #[doc(alias = "CFTreeInsertSibling")]
439 #[inline]
440 pub unsafe fn insert_sibling(&self, new_sibling: Option<&CFTree>) {
441 extern "C-unwind" {
442 fn CFTreeInsertSibling(tree: &CFTree, new_sibling: Option<&CFTree>);
443 }
444 unsafe { CFTreeInsertSibling(self, new_sibling) }
445 }
446
447 /// Removes the tree from its parent.
448 ///
449 /// Parameter `tree`: The tree to be removed. If this parameter is not a valid
450 /// CFTree, the behavior is undefined.
451 #[doc(alias = "CFTreeRemove")]
452 #[inline]
453 pub fn remove(&self) {
454 extern "C-unwind" {
455 fn CFTreeRemove(tree: &CFTree);
456 }
457 unsafe { CFTreeRemove(self) }
458 }
459
460 /// Removes all the children of the tree.
461 ///
462 /// Parameter `tree`: The tree to remove all children from. If this parameter is not a valid
463 /// CFTree, the behavior is undefined.
464 #[doc(alias = "CFTreeRemoveAllChildren")]
465 #[inline]
466 pub fn remove_all_children(&self) {
467 extern "C-unwind" {
468 fn CFTreeRemoveAllChildren(tree: &CFTree);
469 }
470 unsafe { CFTreeRemoveAllChildren(self) }
471 }
472
473 /// Sorts the children of the specified tree using the specified comparator function.
474 ///
475 /// Parameter `tree`: The tree to be operated on. If this parameter is not a valid
476 /// CFTree, the behavior is undefined.
477 ///
478 /// Parameter `comparator`: The function with the comparator function type
479 /// signature which is used in the sort operation to compare
480 /// children of the tree with the given value. If this parameter
481 /// is not a pointer to a function of the correct prototype, the
482 /// the behavior is undefined. The children of the tree are sorted
483 /// from least to greatest according to this function.
484 ///
485 /// Parameter `context`: A pointer-sized user-defined value, which is passed
486 /// as the third parameter to the comparator function, but is
487 /// otherwise unused by this function. If the context is not
488 /// what is expected by the comparator function, the behavior is
489 /// undefined.
490 ///
491 /// # Safety
492 ///
493 /// - `comparator` must be implemented correctly.
494 /// - `context` must be a valid pointer.
495 #[doc(alias = "CFTreeSortChildren")]
496 #[inline]
497 pub unsafe fn sort_children(&self, comparator: CFComparatorFunction, context: *mut c_void) {
498 extern "C-unwind" {
499 fn CFTreeSortChildren(
500 tree: &CFTree,
501 comparator: CFComparatorFunction,
502 context: *mut c_void,
503 );
504 }
505 unsafe { CFTreeSortChildren(self, comparator, context) }
506 }
507}
508
509#[deprecated = "renamed to `CFTree::new`"]
510#[inline]
511pub unsafe extern "C-unwind" fn CFTreeCreate(
512 allocator: Option<&CFAllocator>,
513 context: *const CFTreeContext,
514) -> Option<CFRetained<CFTree>> {
515 extern "C-unwind" {
516 fn CFTreeCreate(
517 allocator: Option<&CFAllocator>,
518 context: *const CFTreeContext,
519 ) -> Option<NonNull<CFTree>>;
520 }
521 let ret = unsafe { CFTreeCreate(allocator, context) };
522 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
523}
524
525#[deprecated = "renamed to `CFTree::parent`"]
526#[inline]
527pub extern "C-unwind" fn CFTreeGetParent(tree: &CFTree) -> Option<CFRetained<CFTree>> {
528 extern "C-unwind" {
529 fn CFTreeGetParent(tree: &CFTree) -> Option<NonNull<CFTree>>;
530 }
531 let ret = unsafe { CFTreeGetParent(tree) };
532 ret.map(|ret| unsafe { CFRetained::retain(ret) })
533}
534
535#[deprecated = "renamed to `CFTree::next_sibling`"]
536#[inline]
537pub extern "C-unwind" fn CFTreeGetNextSibling(tree: &CFTree) -> Option<CFRetained<CFTree>> {
538 extern "C-unwind" {
539 fn CFTreeGetNextSibling(tree: &CFTree) -> Option<NonNull<CFTree>>;
540 }
541 let ret = unsafe { CFTreeGetNextSibling(tree) };
542 ret.map(|ret| unsafe { CFRetained::retain(ret) })
543}
544
545#[deprecated = "renamed to `CFTree::first_child`"]
546#[inline]
547pub extern "C-unwind" fn CFTreeGetFirstChild(tree: &CFTree) -> Option<CFRetained<CFTree>> {
548 extern "C-unwind" {
549 fn CFTreeGetFirstChild(tree: &CFTree) -> Option<NonNull<CFTree>>;
550 }
551 let ret = unsafe { CFTreeGetFirstChild(tree) };
552 ret.map(|ret| unsafe { CFRetained::retain(ret) })
553}
554
555extern "C-unwind" {
556 #[deprecated = "renamed to `CFTree::context`"]
557 pub fn CFTreeGetContext(tree: &CFTree, context: *mut CFTreeContext);
558}
559
560#[deprecated = "renamed to `CFTree::child_count`"]
561#[inline]
562pub extern "C-unwind" fn CFTreeGetChildCount(tree: &CFTree) -> CFIndex {
563 extern "C-unwind" {
564 fn CFTreeGetChildCount(tree: &CFTree) -> CFIndex;
565 }
566 unsafe { CFTreeGetChildCount(tree) }
567}
568
569#[deprecated = "renamed to `CFTree::child_at_index`"]
570#[inline]
571pub extern "C-unwind" fn CFTreeGetChildAtIndex(
572 tree: &CFTree,
573 idx: CFIndex,
574) -> Option<CFRetained<CFTree>> {
575 extern "C-unwind" {
576 fn CFTreeGetChildAtIndex(tree: &CFTree, idx: CFIndex) -> Option<NonNull<CFTree>>;
577 }
578 let ret = unsafe { CFTreeGetChildAtIndex(tree, idx) };
579 ret.map(|ret| unsafe { CFRetained::retain(ret) })
580}
581
582extern "C-unwind" {
583 #[deprecated = "renamed to `CFTree::children`"]
584 pub fn CFTreeGetChildren(tree: &CFTree, children: *mut *mut CFTree);
585}
586
587extern "C-unwind" {
588 #[deprecated = "renamed to `CFTree::apply_function_to_children`"]
589 pub fn CFTreeApplyFunctionToChildren(
590 tree: &CFTree,
591 applier: CFTreeApplierFunction,
592 context: *mut c_void,
593 );
594}
595
596#[deprecated = "renamed to `CFTree::find_root`"]
597#[inline]
598pub extern "C-unwind" fn CFTreeFindRoot(tree: &CFTree) -> Option<CFRetained<CFTree>> {
599 extern "C-unwind" {
600 fn CFTreeFindRoot(tree: &CFTree) -> Option<NonNull<CFTree>>;
601 }
602 let ret = unsafe { CFTreeFindRoot(tree) };
603 ret.map(|ret| unsafe { CFRetained::retain(ret) })
604}
605
606extern "C-unwind" {
607 #[deprecated = "renamed to `CFTree::set_context`"]
608 pub fn CFTreeSetContext(tree: &CFTree, context: *const CFTreeContext);
609}
610
611extern "C-unwind" {
612 #[deprecated = "renamed to `CFTree::prepend_child`"]
613 pub fn CFTreePrependChild(tree: &CFTree, new_child: Option<&CFTree>);
614}
615
616extern "C-unwind" {
617 #[deprecated = "renamed to `CFTree::append_child`"]
618 pub fn CFTreeAppendChild(tree: &CFTree, new_child: Option<&CFTree>);
619}
620
621extern "C-unwind" {
622 #[deprecated = "renamed to `CFTree::insert_sibling`"]
623 pub fn CFTreeInsertSibling(tree: &CFTree, new_sibling: Option<&CFTree>);
624}
625
626#[deprecated = "renamed to `CFTree::remove`"]
627#[inline]
628pub extern "C-unwind" fn CFTreeRemove(tree: &CFTree) {
629 extern "C-unwind" {
630 fn CFTreeRemove(tree: &CFTree);
631 }
632 unsafe { CFTreeRemove(tree) }
633}
634
635#[deprecated = "renamed to `CFTree::remove_all_children`"]
636#[inline]
637pub extern "C-unwind" fn CFTreeRemoveAllChildren(tree: &CFTree) {
638 extern "C-unwind" {
639 fn CFTreeRemoveAllChildren(tree: &CFTree);
640 }
641 unsafe { CFTreeRemoveAllChildren(tree) }
642}
643
644extern "C-unwind" {
645 #[deprecated = "renamed to `CFTree::sort_children`"]
646 pub fn CFTreeSortChildren(
647 tree: &CFTree,
648 comparator: CFComparatorFunction,
649 context: *mut c_void,
650 );
651}