Struct objc2_foundation::NSArray
source · [−]#[repr(C)]pub struct NSArray<T, O: Ownership> { /* private fields */ }
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>
?
Implementations
sourceimpl<T: Message, O: Ownership> NSArray<T, O>
impl<T: Message, O: Ownership> NSArray<T, O>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get(&self, index: usize) -> Option<&T>
pub fn first(&self) -> Option<&T>
pub fn last(&self) -> Option<&T>
pub fn iter(&self) -> NSEnumerator<'_, T>ⓘNotable traits for NSEnumerator<'a, T>impl<'a, T: Message> Iterator for NSEnumerator<'a, T> type Item = &'a T;
pub fn from_vec(vec: Vec<Id<T, O>>) -> Id<Self, O>
pub fn objects_in_range(&self, range: Range<usize>) -> Vec<&T>
pub fn to_vec(&self) -> Vec<&T>
pub fn into_vec(array: Id<Self, Owned>) -> Vec<Id<T, O>>
Methods from Deref<Target = NSObject>
Methods from Deref<Target = Object>
sourcepub unsafe fn ivar<T>(&self, name: &str) -> &T where
T: Encode,
pub unsafe fn ivar<T>(&self, name: &str) -> &T where
T: Encode,
Returns a shared reference to the ivar with the given name.
Panics
Panics if the object has no ivar with the given name, or the type
encoding of the ivar differs from the type encoding of T
.
Safety
The caller must ensure that the ivar is actually of type T
.
Library implementors should expose a safe interface to the ivar.
sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &T where
T: Encode,
👎 Deprecated: Use Object::ivar
instead.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &T where
T: Encode,
Use Object::ivar
instead.
sourcepub unsafe fn ivar_mut<T>(&mut self, name: &str) -> &mut T where
T: Encode,
pub unsafe fn ivar_mut<T>(&mut self, name: &str) -> &mut T where
T: Encode,
Returns a mutable reference to the ivar with the given name.
Panics
Panics if the object has no ivar with the given name, or the type
encoding of the ivar differs from the type encoding of T
.
Safety
The caller must ensure that the ivar is actually of type T
.
Library implementors should expose a safe interface to the ivar.
sourcepub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut T where
T: Encode,
👎 Deprecated: Use Object::ivar_mut
instead.
pub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut T where
T: Encode,
Use Object::ivar_mut
instead.
sourcepub unsafe fn set_ivar<T>(&mut self, name: &str, value: T) where
T: Encode,
pub unsafe fn set_ivar<T>(&mut self, name: &str, value: T) where
T: Encode,
Sets the value of the ivar with the given name.
Panics
Panics if the object has no ivar with the given name, or the type
encoding of the ivar differs from the type encoding of T
.
Safety
The caller must ensure that the ivar is actually of type T
.
Library implementors should expose a safe interface to the ivar.
Trait Implementations
sourceimpl<T, O: Ownership> AsMut<NSArray<T, O>> for NSMutableArray<T, O>
impl<T, O: Ownership> AsMut<NSArray<T, O>> for NSMutableArray<T, O>
sourceimpl<T, O: Ownership> AsRef<NSArray<T, O>> for NSMutableArray<T, O>
impl<T, O: Ownership> AsRef<NSArray<T, O>> for NSMutableArray<T, O>
sourceimpl<T, O: Ownership> Borrow<NSArray<T, O>> for NSMutableArray<T, O>
impl<T, O: Ownership> Borrow<NSArray<T, O>> for NSMutableArray<T, O>
sourceimpl<T, O: Ownership> BorrowMut<NSArray<T, O>> for NSMutableArray<T, O>
impl<T, O: Ownership> BorrowMut<NSArray<T, O>> for NSMutableArray<T, O>
sourcefn borrow_mut(&mut self) -> &mut NSArray<T, O>
fn borrow_mut(&mut self) -> &mut NSArray<T, O>
Mutably borrows from an owned value. Read more
sourceimpl<T, O: Ownership> BorrowMut<NSObject> for NSArray<T, O>
impl<T, O: Ownership> BorrowMut<NSObject> for NSArray<T, O>
sourcefn borrow_mut(&mut self) -> &mut NSObject
fn borrow_mut(&mut self) -> &mut NSObject
Mutably borrows from an owned value. Read more
sourceimpl<T, O: Ownership> BorrowMut<Object> for NSArray<T, O>
impl<T, O: Ownership> BorrowMut<Object> for NSArray<T, O>
sourcefn borrow_mut(&mut self) -> &mut Object
fn borrow_mut(&mut self) -> &mut Object
Mutably borrows from an owned value. Read more
sourceimpl<T: Message, O: Ownership> NSFastEnumeration for NSArray<T, O>
impl<T: Message, O: Ownership> NSFastEnumeration for NSArray<T, O>
type Item = T
fn iter_fast(&self) -> NSFastEnumerator<'_, Self>ⓘNotable traits for NSFastEnumerator<'a, C>impl<'a, C: NSFastEnumeration + ?Sized> Iterator for NSFastEnumerator<'a, C> type Item = &'a C::Item;
sourceimpl<T: Message> NSMutableCopying for NSArray<T, Shared>
impl<T: Message> NSMutableCopying for NSArray<T, Shared>
type Output = NSMutableArray<T, Shared>
type Output = NSMutableArray<T, Shared>
TODO
fn mutable_copy(&self) -> Id<Self::Output, Owned>
sourceimpl<T, O: Ownership> RefEncode for NSArray<T, O>
impl<T, O: Ownership> RefEncode for NSArray<T, O>
sourceconst ENCODING_REF: Encoding<'static> = ::objc2::Encoding::Object
const ENCODING_REF: Encoding<'static> = ::objc2::Encoding::Object
The Objective-C type-encoding for a reference of this type. Read more
sourceimpl<T: Message> ToOwned for NSArray<T, Shared>
impl<T: Message> ToOwned for NSArray<T, Shared>
impl<T: Eq, O: Eq + Ownership> Eq for NSArray<T, O>
impl<T, O: Ownership> Message for NSArray<T, O>
impl<T: Sync + Send> Send for NSArray<T, Shared>
impl<T: Send> Send for NSArray<T, Owned>
impl<T: Sync + Send> Sync for NSArray<T, Shared>
impl<T: Sync> Sync for NSArray<T, Owned>
Auto Trait Implementations
impl<T, O> !RefUnwindSafe for NSArray<T, O>
impl<T, O> !Send for NSArray<T, O>
impl<T, O> !Sync for NSArray<T, O>
impl<T, O> !Unpin for NSArray<T, O>
impl<T, O> !UnwindSafe for NSArray<T, O>
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