Struct objc2_foundation::NSArray [−][src]
#[repr(C)]pub struct NSArray<T, O: Ownership> { /* fields omitted */ }
Expand description
TODO
You can have a Id<NSArray<T, Owned>, Owned>
, which allows mutable access
to the elements (without modifying the array itself), and
Id<NSArray<T, Shared>, Shared>
which allows sharing the array.
Id<NSArray<T, Owned>, Shared>
is possible, but pretty useless.
TODO: Can we make it impossible? Should we?
What about Id<NSArray<T, Shared>, Owned>
?
Trait Implementations
type Ownership = O
type Ownership = O
The NSArray
itself (length and number of items) is always immutable,
but we would like to know when we’re the only owner of the array, to
allow mutation of the array’s items.
We only implement INSCopying
when O = Shared
, so this is safe.
type Item = T
type ItemOwnership = O
fn get_mut(&mut self, index: usize) -> Option<&mut Self::Item> where
Self: INSArray<ItemOwnership = Owned>,
fn get_retained(&self, index: usize) -> Id<Self::Item, Shared> where
Self: INSArray<ItemOwnership = Shared>,
fn iter(&self) -> NSEnumerator<'_, Self::Item>ⓘNotable traits for NSEnumerator<'a, T>impl<'a, T: INSObject> Iterator for NSEnumerator<'a, T> type Item = &'a T;
Notable traits for NSEnumerator<'a, T>
impl<'a, T: INSObject> Iterator for NSEnumerator<'a, T> type Item = &'a T;
type Item = T
fn enumerator(&self) -> NSFastEnumerator<'_, Self>ⓘNotable traits for NSFastEnumerator<'a, C>impl<'a, C: INSFastEnumeration + ?Sized> Iterator for NSFastEnumerator<'a, C> type Item = &'a C::Item;
Notable traits for NSFastEnumerator<'a, C>
impl<'a, C: INSFastEnumeration + ?Sized> Iterator for NSFastEnumerator<'a, C> type Item = &'a C::Item;
type Output = NSMutableArray<T, Shared>
type Output = NSMutableArray<T, Shared>
TODO
The Objective-C type-encoding for a reference of this type. Read more