Struct core_foundation::array::CFArray
source · pub struct CFArray<T = *const c_void>(/* private fields */);
Expand description
A heterogeneous immutable array.
Implementations§
source§impl<T> CFArray<T>
impl<T> CFArray<T>
sourcepub fn from_copyable(elems: &[T]) -> CFArray<T>where
T: Copy,
pub fn from_copyable(elems: &[T]) -> CFArray<T>where
T: Copy,
Creates a new CFArray
with the given elements, which must implement Copy
.
sourcepub fn from_CFTypes(elems: &[T]) -> CFArray<T>where
T: TCFType,
pub fn from_CFTypes(elems: &[T]) -> CFArray<T>where
T: TCFType,
Creates a new CFArray
with the given elements, which must be CFType
objects.
pub fn to_untyped(&self) -> CFArray
sourcepub fn into_untyped(self) -> CFArray
pub fn into_untyped(self) -> CFArray
Returns the same array, but with the type reset to void pointers.
Equal to to_untyped
, but is faster since it does not increment the retain count.
sourcepub fn iter(&self) -> CFArrayIterator<'_, T> ⓘ
pub fn iter(&self) -> CFArrayIterator<'_, T> ⓘ
Iterates over the elements of this CFArray
.
Careful; the loop body must wrap the reference properly. Generally, when array elements are
Core Foundation objects (not always true), they need to be wrapped with
TCFType::wrap_under_get_rule()
.
pub fn len(&self) -> CFIndex
pub unsafe fn get_unchecked(&self, index: CFIndex) -> ItemRef<'_, T>where
T: FromVoid,
pub fn get(&self, index: CFIndex) -> Option<ItemRef<'_, T>>where
T: FromVoid,
pub fn get_values(&self, range: CFRange) -> Vec<*const c_void>
pub fn get_all_values(&self) -> Vec<*const c_void>
Trait Implementations§
source§impl CFPropertyListSubClass for CFArray
impl CFPropertyListSubClass for CFArray
source§fn to_CFPropertyList(&self) -> CFPropertyList
fn to_CFPropertyList(&self) -> CFPropertyList
Create an instance of the superclass type
CFPropertyList
for this instance.source§fn into_CFPropertyList(self) -> CFPropertyListwhere
Self: Sized,
fn into_CFPropertyList(self) -> CFPropertyListwhere
Self: Sized,
Equal to
to_CFPropertyList
, but consumes self and avoids changing the reference count.source§impl<'a, T: FromVoid> IntoIterator for &'a CFArray<T>
impl<'a, T: FromVoid> IntoIterator for &'a CFArray<T>
source§impl<T> TCFType for CFArray<T>
impl<T> TCFType for CFArray<T>
source§fn as_concrete_TypeRef(&self) -> CFArrayRef
fn as_concrete_TypeRef(&self) -> CFArrayRef
Returns the object as its concrete
TypeRef
.source§unsafe fn wrap_under_get_rule(reference: CFArrayRef) -> Self
unsafe fn wrap_under_get_rule(reference: CFArrayRef) -> Self
Returns an instance of the object, wrapping the underlying
CFTypeRef
subclass. Use this
when following Core Foundation’s “Get Rule”. The reference count is bumped.source§fn as_CFTypeRef(&self) -> CFTypeRef
fn as_CFTypeRef(&self) -> CFTypeRef
Returns the object as a raw
CFTypeRef
. The reference count is not adjusted.source§unsafe fn wrap_under_create_rule(reference: CFArrayRef) -> Self
unsafe fn wrap_under_create_rule(reference: CFArrayRef) -> Self
Returns an instance of the object, wrapping the underlying
CFTypeRef
subclass. Use this
when following Core Foundation’s “Create Rule”. The reference count is not bumped.source§fn as_CFType(&self) -> CFType
fn as_CFType(&self) -> CFType
Returns the object as a wrapped
CFType
. The reference count is incremented by one.source§fn into_CFType(self) -> CFTypewhere
Self: Sized,
fn into_CFType(self) -> CFTypewhere
Self: Sized,
Returns the object as a wrapped
CFType
. Consumes self and avoids changing the reference
count.source§fn retain_count(&self) -> CFIndex
fn retain_count(&self) -> CFIndex
Returns the reference count of the object. It is unwise to do anything other than test
whether the return value of this method is greater than zero.
source§fn instance_of<OtherCFType: TCFType>(&self) -> bool
fn instance_of<OtherCFType: TCFType>(&self) -> bool
Returns
true
if this value is an instance of another type.impl ConcreteCFType for CFArray<*const c_void>
impl Eq for CFArray
Auto Trait Implementations§
impl<T> Freeze for CFArray<T>
impl<T> RefUnwindSafe for CFArray<T>where
T: RefUnwindSafe,
impl<T = *const c_void> !Send for CFArray<T>
impl<T = *const c_void> !Sync for CFArray<T>
impl<T> Unpin for CFArray<T>where
T: Unpin,
impl<T> UnwindSafe for CFArray<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)