Struct cacao::foundation::NSArray
source · [−]Expand description
A wrapper for NSArray
that makes common operations in our framework a bit easier to handle
and reason about. This also provides a central place to look at replacing with CFArray
if
ever deemed necessary (unlikely, given how much Apple has optimized the Foundation classes, but
still…).
Tuple Fields
0: Id<Object>
Implementations
sourceimpl NSArray
impl NSArray
sourcepub fn new(objects: &[id]) -> Self
pub fn new(objects: &[id]) -> Self
Given a set of Object
s, creates and retains an NSArray
that holds them.
sourcepub fn retain(array: id) -> Self
pub fn retain(array: id) -> Self
In some cases, we’re vended an NSArray
by the system that we need to call retain on.
This handles that case.
sourcepub fn from_retained(array: id) -> Self
pub fn from_retained(array: id) -> Self
In some cases, we’re vended an NSArray
by the system, and it’s ideal to not retain that.
This handles that edge case.
Methods from Deref<Target = Object>
sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &T where
T: Encode,
pub unsafe fn get_ivar<T>(&self, name: &str) -> &T where
T: Encode,
Returns a reference to the ivar of self with the given name.
Panics if self has no ivar with the given name.
Unsafe because the caller must ensure that the ivar is actually
of type T
.
sourcepub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut T where
T: Encode,
pub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut T where
T: Encode,
Returns a mutable reference to the ivar of self with the given name.
Panics if self has no ivar with the given name.
Unsafe because the caller must ensure that the ivar is actually
of type T
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for NSArray
impl Send for NSArray
impl Sync for NSArray
impl Unpin for NSArray
impl UnwindSafe for NSArray
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more