Struct core_foundation::dictionary::CFDictionary
source · pub struct CFDictionary<K = *const c_void, V = *const c_void>(/* private fields */);
Implementations§
source§impl<K, V> CFDictionary<K, V>
impl<K, V> CFDictionary<K, V>
pub fn from_CFType_pairs(pairs: &[(K, V)]) -> CFDictionary<K, V>where K: TCFType, V: TCFType,
pub fn to_untyped(&self) -> CFDictionary
sourcepub unsafe fn to_mutable(&self) -> CFMutableDictionary<K, V>
pub unsafe fn to_mutable(&self) -> CFMutableDictionary<K, V>
Returns a CFMutableDictionary
pointing to the same underlying dictionary as this immutable one.
This should only be used when the underlying dictionary is mutable.
sourcepub fn into_untyped(self) -> CFDictionary
pub fn into_untyped(self) -> CFDictionary
Returns the same dictionary, but with the types reset to void pointers.
Equal to to_untyped
, but is faster since it does not increment the retain count.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn contains_key(&self, key: &K) -> boolwhere K: ToVoid<K>,
pub fn find<T: ToVoid<K>>(&self, key: T) -> Option<ItemRef<'_, V>>where V: FromVoid, K: ToVoid<K>,
sourcepub fn get<T: ToVoid<K>>(&self, key: T) -> ItemRef<'_, V>where
V: FromVoid,
K: ToVoid<K>,
pub fn get<T: ToVoid<K>>(&self, key: T) -> ItemRef<'_, V>where V: FromVoid, K: ToVoid<K>,
Panics
Panics if the key is not present in the dictionary. Use find
to get an Option
instead
of panicking.
pub fn get_keys_and_values(&self) -> (Vec<*const c_void>, Vec<*const c_void>)
Trait Implementations§
source§impl CFPropertyListSubClass for CFDictionary
impl CFPropertyListSubClass for CFDictionary
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 Clone for CFDictionary
impl Clone for CFDictionary
source§fn clone(&self) -> CFDictionary
fn clone(&self) -> CFDictionary
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<K, V> Debug for CFDictionary<K, V>
impl<K, V> Debug for CFDictionary<K, V>
source§impl<K, V> Drop for CFDictionary<K, V>
impl<K, V> Drop for CFDictionary<K, V>
source§impl<'a, K, V> From<&'a CFDictionary<K, V>> for CFMutableDictionary<K, V>
impl<'a, K, V> From<&'a CFDictionary<K, V>> for CFMutableDictionary<K, V>
source§fn from(dict: &'a CFDictionary<K, V>) -> Self
fn from(dict: &'a CFDictionary<K, V>) -> Self
Creates a new mutable dictionary with the key-value pairs from another dictionary. The capacity of the new mutable dictionary is not limited.
source§impl PartialEq for CFDictionary
impl PartialEq for CFDictionary
source§fn eq(&self, other: &CFDictionary) -> bool
fn eq(&self, other: &CFDictionary) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<K, V> TCFType for CFDictionary<K, V>
impl<K, V> TCFType for CFDictionary<K, V>
§type Ref = *const __CFDictionary
type Ref = *const __CFDictionary
The reference type wrapped inside this type.
source§fn as_concrete_TypeRef(&self) -> CFDictionaryRef
fn as_concrete_TypeRef(&self) -> CFDictionaryRef
Returns the object as its concrete
TypeRef
.source§unsafe fn wrap_under_get_rule(reference: CFDictionaryRef) -> Self
unsafe fn wrap_under_get_rule(reference: CFDictionaryRef) -> 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: CFDictionaryRef) -> Self
unsafe fn wrap_under_create_rule(reference: CFDictionaryRef) -> 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.source§impl<'a> ToVoid<CFDictionary> for &'a CFDictionary
impl<'a> ToVoid<CFDictionary> for &'a CFDictionary
source§impl ToVoid<CFDictionary> for CFDictionaryRef
impl ToVoid<CFDictionary> for CFDictionaryRef
source§impl ToVoid<CFDictionary> for CFDictionary
impl ToVoid<CFDictionary> for CFDictionary
impl ConcreteCFType for CFDictionary<*const c_void, *const c_void>
impl Eq for CFDictionary
Auto Trait Implementations§
impl<K, V> RefUnwindSafe for CFDictionary<K, V>where K: RefUnwindSafe, V: RefUnwindSafe,
impl<K = *const c_void, V = *const c_void> !Send for CFDictionary<K, V>
impl<K = *const c_void, V = *const c_void> !Sync for CFDictionary<K, V>
impl<K, V> Unpin for CFDictionary<K, V>where K: Unpin, V: Unpin,
impl<K, V> UnwindSafe for CFDictionary<K, V>where K: UnwindSafe, V: 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