#[repr(C)]pub struct NSArray<ObjectType = AnyObject>where
ObjectType: ?Sized,{ /* private fields */ }
Implementations§
source§impl<T> NSArray<T>where
T: Message,
impl<T> NSArray<T>where
T: Message,
pub fn from_vec(vec: Vec<Retained<T>>) -> Retained<NSArray<T>>
pub fn from_id_slice(slice: &[Retained<T>]) -> Retained<NSArray<T>>where
T: IsIdCloneable,
pub fn from_slice(slice: &[&T]) -> Retained<NSArray<T>>where
T: IsRetainable,
pub fn to_vec(&self) -> Vec<&T>
pub fn to_vec_retained(&self) -> Vec<Retained<T>>where
T: IsIdCloneable,
source§impl<T> NSArray<T>where
T: Message,
impl<T> NSArray<T>where
T: Message,
pub fn get(&self, index: usize) -> Option<&T>
pub fn get_retained(&self, index: usize) -> Option<Retained<T>>where
T: IsIdCloneable,
pub fn get_mut(&mut self, index: usize) -> Option<&mut T>where
T: IsMutable,
pub fn first(&self) -> Option<&T>
pub fn first_retained(&self) -> Option<Retained<T>>where
T: IsIdCloneable,
pub fn first_mut(&mut self) -> Option<&mut T>where
T: IsMutable,
pub fn last(&self) -> Option<&T>
pub fn last_retained(&self) -> Option<Retained<T>>where
T: IsIdCloneable,
pub fn last_mut(&mut self) -> Option<&mut T>where
T: IsMutable,
source§impl<ObjectType> NSArray<ObjectType>where
ObjectType: Message,
impl<ObjectType> NSArray<ObjectType>where
ObjectType: Message,
pub fn count(&self) -> usize
pub unsafe fn objectAtIndex(&self, index: usize) -> Retained<ObjectType>
pub fn init( this: Allocated<NSArray<ObjectType>>, ) -> Retained<NSArray<ObjectType>>
pub unsafe fn initWithObjects_count( this: Allocated<NSArray<ObjectType>>, objects: *mut NonNull<ObjectType>, cnt: usize, ) -> Retained<NSArray<ObjectType>>
pub unsafe fn initWithCoder( this: Allocated<NSArray<ObjectType>>, coder: &NSCoder, ) -> Option<Retained<NSArray<ObjectType>>>
source§impl<ObjectType> NSArray<ObjectType>where
ObjectType: Message,
impl<ObjectType> NSArray<ObjectType>where
ObjectType: Message,
Methods declared on superclass NSObject
source§impl<ObjectType> NSArray<ObjectType>where
ObjectType: Message,
impl<ObjectType> NSArray<ObjectType>where
ObjectType: Message,
NSExtendedArray
pub unsafe fn arrayByAddingObject( &self, an_object: &ObjectType, ) -> Retained<NSArray<ObjectType>>
pub unsafe fn arrayByAddingObjectsFromArray( &self, other_array: &NSArray<ObjectType>, ) -> Retained<NSArray<ObjectType>>
pub unsafe fn componentsJoinedByString( &self, separator: &NSString, ) -> Retained<NSString>
pub unsafe fn containsObject(&self, an_object: &ObjectType) -> bool
pub unsafe fn description(&self) -> Retained<NSString>
pub unsafe fn descriptionWithLocale( &self, locale: Option<&AnyObject>, ) -> Retained<NSString>
pub unsafe fn descriptionWithLocale_indent( &self, locale: Option<&AnyObject>, level: usize, ) -> Retained<NSString>
pub unsafe fn firstObjectCommonWithArray( &self, other_array: &NSArray<ObjectType>, ) -> Option<Retained<ObjectType>>
pub unsafe fn getObjects_range( &self, objects: NonNull<NonNull<ObjectType>>, range: NSRange, )
pub unsafe fn indexOfObject(&self, an_object: &ObjectType) -> usize
pub unsafe fn indexOfObject_inRange( &self, an_object: &ObjectType, range: NSRange, ) -> usize
pub unsafe fn indexOfObjectIdenticalTo(&self, an_object: &ObjectType) -> usize
pub unsafe fn indexOfObjectIdenticalTo_inRange( &self, an_object: &ObjectType, range: NSRange, ) -> usize
pub unsafe fn isEqualToArray(&self, other_array: &NSArray<ObjectType>) -> bool
pub unsafe fn firstObject(&self) -> Option<Retained<ObjectType>>
pub unsafe fn lastObject(&self) -> Option<Retained<ObjectType>>
pub unsafe fn sortedArrayHint(&self) -> Retained<NSData>
pub unsafe fn sortedArrayUsingFunction_context( &self, comparator: unsafe extern "C" fn(_: NonNull<ObjectType>, _: NonNull<ObjectType>, _: *mut c_void) -> isize, context: *mut c_void, ) -> Retained<NSArray<ObjectType>>
pub unsafe fn sortedArrayUsingFunction_context_hint( &self, comparator: unsafe extern "C" fn(_: NonNull<ObjectType>, _: NonNull<ObjectType>, _: *mut c_void) -> isize, context: *mut c_void, hint: Option<&NSData>, ) -> Retained<NSArray<ObjectType>>
pub unsafe fn sortedArrayUsingSelector( &self, comparator: Sel, ) -> Retained<NSArray<ObjectType>>
pub unsafe fn subarrayWithRange( &self, range: NSRange, ) -> Retained<NSArray<ObjectType>>
pub unsafe fn writeToURL_error( &self, url: &NSURL, ) -> Result<(), Retained<NSError>>
pub unsafe fn makeObjectsPerformSelector(&self, a_selector: Sel)
pub unsafe fn makeObjectsPerformSelector_withObject( &self, a_selector: Sel, argument: Option<&AnyObject>, )
pub unsafe fn objectAtIndexedSubscript( &self, idx: usize, ) -> Retained<ObjectType>
source§impl<ObjectType> NSArray<ObjectType>where
ObjectType: Message,
impl<ObjectType> NSArray<ObjectType>where
ObjectType: Message,
NSArrayCreation
pub unsafe fn array() -> Retained<NSArray<ObjectType>>
pub unsafe fn arrayWithObject( an_object: &ObjectType, ) -> Retained<NSArray<ObjectType>>
pub unsafe fn arrayWithObjects_count( objects: NonNull<NonNull<ObjectType>>, cnt: usize, ) -> Retained<NSArray<ObjectType>>
pub unsafe fn arrayWithArray( array: &NSArray<ObjectType>, ) -> Retained<NSArray<ObjectType>>
pub unsafe fn initWithArray( this: Allocated<NSArray<ObjectType>>, array: &NSArray<ObjectType>, ) -> Retained<NSArray<ObjectType>>
pub unsafe fn initWithArray_copyItems( this: Allocated<NSArray<ObjectType>>, array: &NSArray<ObjectType>, flag: bool, ) -> Retained<NSArray<ObjectType>>
pub unsafe fn initWithContentsOfURL_error( this: Allocated<NSArray<ObjectType>>, url: &NSURL, ) -> Result<Retained<NSArray<ObjectType>>, Retained<NSError>>
pub unsafe fn arrayWithContentsOfURL_error( url: &NSURL, ) -> Result<Retained<NSArray<ObjectType>>, Retained<NSError>>
impl<ObjectType> NSArray<ObjectType>where
ObjectType: Message,
This impl block contains no items.
NSArrayDiffing
source§impl<ObjectType> NSArray<ObjectType>where
ObjectType: Message,
impl<ObjectType> NSArray<ObjectType>where
ObjectType: Message,
NSDeprecated
pub unsafe fn getObjects(&self, objects: NonNull<NonNull<ObjectType>>)
👎Deprecated: Use -getObjects:range: instead
pub unsafe fn arrayWithContentsOfFile( path: &NSString, ) -> Option<Retained<NSArray<ObjectType>>>
👎Deprecated
pub unsafe fn arrayWithContentsOfURL( url: &NSURL, ) -> Option<Retained<NSArray<ObjectType>>>
👎Deprecated
pub unsafe fn initWithContentsOfFile( this: Allocated<NSArray<ObjectType>>, path: &NSString, ) -> Option<Retained<NSArray<ObjectType>>>
👎Deprecated
pub unsafe fn initWithContentsOfURL( this: Allocated<NSArray<ObjectType>>, url: &NSURL, ) -> Option<Retained<NSArray<ObjectType>>>
👎Deprecated
pub unsafe fn writeToFile_atomically( &self, path: &NSString, use_auxiliary_file: bool, ) -> bool
👎Deprecated
pub unsafe fn writeToURL_atomically( &self, url: &NSURL, atomically: bool, ) -> bool
👎Deprecated
Methods from Deref<Target = NSObject>§
sourcepub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
Handle messages the object doesn’t recognize.
See Apple’s documentation for details.
Methods from Deref<Target = AnyObject>§
sourcepub fn class(&self) -> &'static AnyClass
pub fn class(&self) -> &'static AnyClass
Dynamically find the class of this object.
§Example
Check that an instance of NSObject
has the precise class NSObject
.
use objc2::ClassType;
use objc2::runtime::NSObject;
let obj = NSObject::new();
assert_eq!(obj.class(), NSObject::class());
sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load
instead.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Ivar::load
instead.Use Ivar::load
instead.
§Safety
The object must have an instance variable with the given name, and it
must be of type T
.
See Ivar::load_ptr
for details surrounding this.
sourcepub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load_mut
instead.
pub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
Ivar::load_mut
instead.Use Ivar::load_mut
instead.
§Safety
The object must have an instance variable with the given name, and it
must be of type T
.
See Ivar::load_ptr
for details surrounding this.
Trait Implementations§
source§impl<ObjectType> BorrowMut<AnyObject> for NSArray<ObjectType>
impl<ObjectType> BorrowMut<AnyObject> for NSArray<ObjectType>
source§fn borrow_mut(&mut self) -> &mut AnyObject
fn borrow_mut(&mut self) -> &mut AnyObject
Mutably borrows from an owned value. Read more
source§impl<ObjectType> BorrowMut<NSObject> for NSArray<ObjectType>
impl<ObjectType> BorrowMut<NSObject> for NSArray<ObjectType>
source§fn borrow_mut(&mut self) -> &mut NSObject
fn borrow_mut(&mut self) -> &mut NSObject
Mutably borrows from an owned value. Read more
source§impl<ObjectType> ClassType for NSArray<ObjectType>
impl<ObjectType> ClassType for NSArray<ObjectType>
source§const NAME: &'static str = "NSArray"
const NAME: &'static str = "NSArray"
The name of the Objective-C class that this type represents. Read more
source§type Mutability = ImmutableWithMutableSubclass<NSMutableArray<ObjectType>>
type Mutability = ImmutableWithMutableSubclass<NSMutableArray<ObjectType>>
Whether the type is mutable or immutable. Read more
source§fn class() -> &'static AnyClass
fn class() -> &'static AnyClass
Get a reference to the Objective-C class that this type represents. Read more
source§fn as_super(&self) -> &<NSArray<ObjectType> as ClassType>::Super
fn as_super(&self) -> &<NSArray<ObjectType> as ClassType>::Super
Get an immutable reference to the superclass.
source§impl<ObjectType> DefaultRetained for NSArray<ObjectType>where
ObjectType: Message,
impl<ObjectType> DefaultRetained for NSArray<ObjectType>where
ObjectType: Message,
source§impl<ObjectType> RefEncode for NSArray<ObjectType>
impl<ObjectType> RefEncode for NSArray<ObjectType>
source§const ENCODING_REF: Encoding = <NSObject as ::objc2::RefEncode>::ENCODING_REF
const ENCODING_REF: Encoding = <NSObject as ::objc2::RefEncode>::ENCODING_REF
The Objective-C type-encoding for a reference of this type. Read more
source§impl<'a, T> RetainedFromIterator<&'a T> for NSArray<T>where
T: Message + IsRetainable + 'a,
impl<'a, T> RetainedFromIterator<&'a T> for NSArray<T>where
T: Message + IsRetainable + 'a,
source§fn id_from_iter<I>(iter: I) -> Retained<NSArray<T>>where
I: IntoIterator<Item = &'a T>,
fn id_from_iter<I>(iter: I) -> Retained<NSArray<T>>where
I: IntoIterator<Item = &'a T>,
Creates an
Retained
from an iterator. Read moresource§fn retained_from_iter<I>(iter: I) -> Retained<Self>where
I: IntoIterator<Item = T>,
fn retained_from_iter<I>(iter: I) -> Retained<Self>where
I: IntoIterator<Item = T>,
Creates an
Retained
from an iterator.source§impl<T> RetainedFromIterator<Retained<T>> for NSArray<T>where
T: Message,
impl<T> RetainedFromIterator<Retained<T>> for NSArray<T>where
T: Message,
source§fn id_from_iter<I>(iter: I) -> Retained<NSArray<T>>where
I: IntoIterator<Item = Retained<T>>,
fn id_from_iter<I>(iter: I) -> Retained<NSArray<T>>where
I: IntoIterator<Item = Retained<T>>,
Creates an
Retained
from an iterator. Read moresource§fn retained_from_iter<I>(iter: I) -> Retained<Self>where
I: IntoIterator<Item = T>,
fn retained_from_iter<I>(iter: I) -> Retained<Self>where
I: IntoIterator<Item = T>,
Creates an
Retained
from an iterator.source§impl<T> ToOwned for NSArray<T>where
T: Message + IsIdCloneable,
impl<T> ToOwned for NSArray<T>where
T: Message + IsIdCloneable,
impl<ObjectType> Eq for NSArray<ObjectType>
impl<ObjectType> Message for NSArray<ObjectType>
impl<ObjectType> NSCoding for NSArray<ObjectType>
impl<ObjectType> NSCopying for NSArray<ObjectType>where
ObjectType: IsIdCloneable + ?Sized,
impl<ObjectType> NSMutableCopying for NSArray<ObjectType>where
ObjectType: IsIdCloneable + ?Sized,
impl<ObjectType> NSObjectProtocol for NSArray<ObjectType>where
ObjectType: ?Sized,
impl<ObjectType> NSSecureCoding for NSArray<ObjectType>where
ObjectType: NSSecureCoding + ?Sized,
impl<ObjectType> StructuralPartialEq for NSArray<ObjectType>where
ObjectType: ?Sized,
Auto Trait Implementations§
impl<ObjectType = AnyObject> !Freeze for NSArray<ObjectType>
impl<ObjectType> RefUnwindSafe for NSArray<ObjectType>where
ObjectType: RefUnwindSafe + ?Sized,
impl<ObjectType> Send for NSArray<ObjectType>where
ObjectType: ClassType + Send + ?Sized,
<ObjectType as ClassType>::Mutability: SendSyncHelper<ObjectType>,
<<ObjectType as ClassType>::Mutability as SendSyncHelper<ObjectType>>::EquivalentType: Send,
impl<ObjectType> Sync for NSArray<ObjectType>where
ObjectType: ClassType + Sync + ?Sized,
<ObjectType as ClassType>::Mutability: SendSyncHelper<ObjectType>,
<<ObjectType as ClassType>::Mutability as SendSyncHelper<ObjectType>>::EquivalentType: Sync,
impl<ObjectType = AnyObject> !Unpin for NSArray<ObjectType>
impl<ObjectType> UnwindSafe for NSArray<ObjectType>
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