CFTree

Struct CFTree 

Source
#[repr(C)]
pub struct CFTree { /* private fields */ }
Available on crate feature CFTree only.
Expand description

This is the type of a reference to CFTrees.

See also Apple’s documentation

Implementations§

Source§

impl CFTree

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>§

Source

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.

Source

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 CFNumbers, small CFStrings etc.) may not have a normal retain count for optimization purposes, and can return usize::MAX in that case.

Trait Implementations§

Source§

impl AsRef<AnyObject> for CFTree

Source§

fn as_ref(&self) -> &AnyObject

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CFTree> for CFTree

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CFType> for CFTree

Source§

fn as_ref(&self) -> &CFType

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<AnyObject> for CFTree

Source§

fn borrow(&self) -> &AnyObject

Immutably borrows from an owned value. Read more
Source§

impl Borrow<CFType> for CFTree

Source§

fn borrow(&self) -> &CFType

Immutably borrows from an owned value. Read more
Source§

impl ConcreteType for CFTree

Source§

fn type_id() -> CFTypeID

Returns the type identifier of all CFTree instances.

Source§

impl Debug for CFTree

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for CFTree

Source§

type Target = CFType

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Hash for CFTree

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Message for CFTree

Source§

fn retain(&self) -> Retained<Self>
where Self: Sized,

Increment the reference count of the receiver. Read more
Source§

impl PartialEq for CFTree

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl RefEncode for CFTree

Source§

const ENCODING_REF: Encoding

The Objective-C type-encoding for a reference of this type. Read more
Source§

impl Type for CFTree

Source§

fn retain(&self) -> CFRetained<Self>
where Self: Sized,

Increment the reference count of the receiver. Read more
Source§

fn as_concrete_TypeRef(&self) -> &Self

👎Deprecated: this is redundant
Helper for easier transition from the core-foundation crate.
Source§

unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>
where Self: Sized,

👎Deprecated: use CFRetained::retain
Helper for easier transition from the core-foundation crate. Read more
Source§

fn as_CFTypeRef(&self) -> &CFType
where Self: AsRef<CFType>,

👎Deprecated: this is redundant (CF types deref to CFType)
Helper for easier transition from the core-foundation crate.
Source§

unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>
where Self: Sized,

👎Deprecated: use CFRetained::from_raw
Helper for easier transition from the core-foundation crate. Read more
Source§

impl Eq for CFTree

Auto Trait Implementations§

§

impl !Freeze for CFTree

§

impl !RefUnwindSafe for CFTree

§

impl !Send for CFTree

§

impl !Sync for CFTree

§

impl !Unpin for CFTree

§

impl !UnwindSafe for CFTree

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,