#[repr(C)]pub struct CFTree { /* private fields */ }
CFTree
only.Expand description
This is the type of a reference to CFTrees.
See also Apple’s documentation
Implementations§
Source§impl CFTree
impl CFTree
Sourcepub unsafe fn new(
allocator: Option<&CFAllocator>,
context: *const CFTreeContext,
) -> Option<CFRetained<CFTree>>
pub unsafe fn new( allocator: Option<&CFAllocator>, context: *const CFTreeContext, ) -> Option<CFRetained<CFTree>>
Creates a new mutable tree.
Parameter allocator
: The CFAllocator which should be used to allocate
memory for the tree and storage for its children. This
parameter may be NULL in which case the current default
CFAllocator is used. If this reference is not a valid
CFAllocator, the behavior is undefined.
Parameter context
: A C pointer to a CFTreeContext structure to be copied
and used as the context of the new tree. The info parameter
will be retained by the tree if a retain function is provided.
If this value is not a valid C pointer to a CFTreeContext
structure-sized block of storage, the result is undefined.
If the version number of the storage is not a valid CFTreeContext
version number, the result is undefined.
Returns: A reference to the new CFTree.
Sourcepub unsafe fn parent(self: &CFTree) -> Option<CFRetained<CFTree>>
pub unsafe fn parent(self: &CFTree) -> Option<CFRetained<CFTree>>
Returns the parent of the specified tree.
Parameter tree
: The tree to be queried. If this parameter is not a valid
CFTree, the behavior is undefined.
Returns: The parent of the tree.
Sourcepub unsafe fn next_sibling(self: &CFTree) -> Option<CFRetained<CFTree>>
pub unsafe fn next_sibling(self: &CFTree) -> Option<CFRetained<CFTree>>
Returns the sibling after the specified tree in the parent tree’s list.
Parameter tree
: The tree to be queried. If this parameter is not a valid
CFTree, the behavior is undefined.
Returns: The next sibling of the tree.
Sourcepub unsafe fn first_child(self: &CFTree) -> Option<CFRetained<CFTree>>
pub unsafe fn first_child(self: &CFTree) -> Option<CFRetained<CFTree>>
Returns the first child of the tree.
Parameter tree
: The tree to be queried. If this parameter is not a valid
CFTree, the behavior is undefined.
Returns: The first child of the tree.
Sourcepub unsafe fn context(self: &CFTree, context: *mut CFTreeContext)
pub unsafe fn context(self: &CFTree, context: *mut CFTreeContext)
Returns the context of the specified tree.
Parameter tree
: The tree to be queried. If this parameter is not a valid
CFTree, the behavior is undefined.
Parameter context
: A C pointer to a CFTreeContext structure to be filled in with
the context of the specified tree. If this value is not a valid C
pointer to a CFTreeContext structure-sized block of storage, the
result is undefined. If the version number of the storage is not
a valid CFTreeContext version number, the result is undefined.
Sourcepub unsafe fn child_count(self: &CFTree) -> CFIndex
pub unsafe fn child_count(self: &CFTree) -> CFIndex
Returns the number of children of the specified tree.
Parameter tree
: The tree to be queried. If this parameter is not a valid
CFTree, the behavior is undefined.
Returns: The number of children.
Sourcepub unsafe fn child_at_index(
self: &CFTree,
idx: CFIndex,
) -> Option<CFRetained<CFTree>>
pub unsafe fn child_at_index( self: &CFTree, idx: CFIndex, ) -> Option<CFRetained<CFTree>>
Returns the nth child of the specified tree.
Parameter tree
: The tree to be queried. If this parameter is not a valid
CFTree, the behavior is undefined.
Parameter idx
: The index of the child tree to be returned. If this parameter
is less than zero or greater than the number of children of the
tree, the result is undefined.
Returns: A reference to the specified child tree.
Sourcepub unsafe fn children(self: &CFTree, children: *mut *mut CFTree)
pub unsafe fn children(self: &CFTree, children: *mut *mut CFTree)
Fills the buffer with children from the tree.
Parameter tree
: The tree to be queried. If this parameter is not a valid
CFTree, the behavior is undefined.
Parameter children
: A C array of pointer-sized values to be filled with
children from the tree. If this parameter is not a valid pointer to a
C array of at least CFTreeGetChildCount() pointers, the behavior is undefined.
Sourcepub unsafe fn apply_function_to_children(
self: &CFTree,
applier: CFTreeApplierFunction,
context: *mut c_void,
)
pub unsafe fn apply_function_to_children( self: &CFTree, applier: CFTreeApplierFunction, context: *mut c_void, )
Calls a function once for each child of the tree. Note that the applier only operates one level deep, and does not operate on descendents further removed than the immediate children of the tree.
Parameter tree
: The tree to be operated upon. If this parameter is not a
valid CFTree, the behavior is undefined.
Parameter applier
: The callback function to call once for each child of
the given tree. If this parameter is not a pointer to a
function of the correct prototype, the behavior is undefined.
If there are values in the tree which the applier function does
not expect or cannot properly apply to, the behavior is undefined.
Parameter context
: A pointer-sized user-defined value, which is passed
as the second parameter to the applier function, but is
otherwise unused by this function. If the context is not
what is expected by the applier function, the behavior is
undefined.
Sourcepub unsafe fn find_root(self: &CFTree) -> Option<CFRetained<CFTree>>
pub unsafe fn find_root(self: &CFTree) -> Option<CFRetained<CFTree>>
Returns the root tree of which the specified tree is a descendent.
Parameter tree
: The tree to be queried. If this parameter is not a valid
CFTree, the behavior is undefined.
Returns: A reference to the root of the tree.
Sourcepub unsafe fn set_context(self: &CFTree, context: *const CFTreeContext)
pub unsafe fn set_context(self: &CFTree, context: *const CFTreeContext)
Replaces the context of a tree. The tree releases its retain on the info of the previous context, and retains the info of the new context.
Parameter tree
: The tree to be operated on. If this parameter is not a valid
CFTree, the behavior is undefined.
Parameter context
: A C pointer to a CFTreeContext structure to be copied
and used as the context of the new tree. The info parameter
will be retained by the tree if a retain function is provided.
If this value is not a valid C pointer to a CFTreeContext
structure-sized block of storage, the result is undefined.
If the version number of the storage is not a valid CFTreeContext
version number, the result is undefined.
Sourcepub unsafe fn prepend_child(self: &CFTree, new_child: Option<&CFTree>)
pub unsafe fn prepend_child(self: &CFTree, new_child: Option<&CFTree>)
Adds the newChild to the specified tree as the first in its list of children.
Parameter tree
: The tree to be operated on. If this parameter is not a valid
CFTree, the behavior is undefined.
Parameter newChild
: The child to be added.
If this parameter is not a valid CFTree, the behavior is undefined.
If this parameter is a tree which is already a child of any tree,
the behavior is undefined.
Sourcepub unsafe fn append_child(self: &CFTree, new_child: Option<&CFTree>)
pub unsafe fn append_child(self: &CFTree, new_child: Option<&CFTree>)
Adds the newChild to the specified tree as the last in its list of children.
Parameter tree
: The tree to be operated on. If this parameter is not a valid
CFTree, the behavior is undefined.
Parameter newChild
: The child to be added.
If this parameter is not a valid CFTree, the behavior is undefined.
If this parameter is a tree which is already a child of any tree,
the behavior is undefined.
Sourcepub unsafe fn insert_sibling(self: &CFTree, new_sibling: Option<&CFTree>)
pub unsafe fn insert_sibling(self: &CFTree, new_sibling: Option<&CFTree>)
Inserts newSibling into the the parent tree’s linked list of children after tree. The newSibling will have the same parent as tree.
Parameter tree
: The tree to insert newSibling after. If this parameter is not a valid
CFTree, the behavior is undefined. If the tree does not have a
parent, the behavior is undefined.
Parameter newSibling
: The sibling to be added.
If this parameter is not a valid CFTree, the behavior is undefined.
If this parameter is a tree which is already a child of any tree,
the behavior is undefined.
Sourcepub unsafe fn remove(self: &CFTree)
pub unsafe fn remove(self: &CFTree)
Removes the tree from its parent.
Parameter tree
: The tree to be removed. If this parameter is not a valid
CFTree, the behavior is undefined.
Sourcepub unsafe fn remove_all_children(self: &CFTree)
pub unsafe fn remove_all_children(self: &CFTree)
Removes all the children of the tree.
Parameter tree
: The tree to remove all children from. If this parameter is not a valid
CFTree, the behavior is undefined.
Sourcepub unsafe fn sort_children(
self: &CFTree,
comparator: CFComparatorFunction,
context: *mut c_void,
)
pub unsafe fn sort_children( self: &CFTree, comparator: CFComparatorFunction, context: *mut c_void, )
Sorts the children of the specified tree using the specified comparator function.
Parameter tree
: The tree to be operated on. If this parameter is not a valid
CFTree, the behavior is undefined.
Parameter comparator
: The function with the comparator function type
signature which is used in the sort operation to compare
children of the tree with the given value. If this parameter
is not a pointer to a function of the correct prototype, the
the behavior is undefined. The children of the tree are sorted
from least to greatest according to this function.
Parameter context
: A pointer-sized user-defined value, which is passed
as the third parameter to the comparator function, but is
otherwise unused by this function. If the context is not
what is expected by the comparator function, the behavior is
undefined.
Methods from Deref<Target = CFType>§
Sourcepub fn downcast_ref<T: ConcreteType>(&self) -> Option<&T>
pub fn downcast_ref<T: ConcreteType>(&self) -> Option<&T>
Attempt to downcast the type to that of type T
.
This is the reference-variant. Use CFRetained::downcast
if you
want to convert a retained type. See also ConcreteType
for more
details on which types support being converted to.
Sourcepub fn retain_count(&self) -> usize
pub fn retain_count(&self) -> usize
Get the reference count of the object.
This function may be useful for debugging. You normally do not use this function otherwise.
Beware that some things (like CFNumber
s, small CFString
s etc.) may
not have a normal retain count for optimization purposes, and can
return usize::MAX
in that case.
Trait Implementations§
Source§impl ConcreteType for CFTree
impl ConcreteType for CFTree
Source§impl RefEncode for CFTree
impl RefEncode for CFTree
Source§const ENCODING_REF: Encoding
const ENCODING_REF: Encoding
Source§impl Type for CFTree
impl Type for CFTree
Source§fn retain(&self) -> CFRetained<Self> ⓘwhere
Self: Sized,
fn retain(&self) -> CFRetained<Self> ⓘwhere
Self: Sized,
Source§fn as_concrete_TypeRef(&self) -> &Self
fn as_concrete_TypeRef(&self) -> &Self
core-foundation
crate.Source§unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self> ⓘwhere
Self: Sized,
unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self> ⓘwhere
Self: Sized,
core-foundation
crate. Read moreSource§fn as_CFTypeRef(&self) -> &CFType
fn as_CFTypeRef(&self) -> &CFType
core-foundation
crate.Source§unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self> ⓘwhere
Self: Sized,
unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self> ⓘwhere
Self: Sized,
core-foundation
crate. Read more