accesskit_macos

Struct NSArray

source
#[repr(C)]
pub struct NSArray<ObjectType = AnyObject>
where ObjectType: ?Sized,
{ /* private fields */ }

Implementations§

source§

impl<T> NSArray<T>
where T: Message,

source

pub fn from_vec(vec: Vec<Retained<T>>) -> Retained<NSArray<T>>

source

pub fn from_id_slice(slice: &[Retained<T>]) -> Retained<NSArray<T>>
where T: IsIdCloneable,

source

pub fn from_slice(slice: &[&T]) -> Retained<NSArray<T>>
where T: IsRetainable,

source

pub fn to_vec(&self) -> Vec<&T>

source

pub fn to_vec_retained(&self) -> Vec<Retained<T>>
where T: IsIdCloneable,

source§

impl<T> NSArray<T>
where T: Message,

source

pub fn len(&self) -> usize

source

pub fn is_empty(&self) -> bool

source§

impl<T> NSArray<T>
where T: Message,

source

pub fn get(&self, index: usize) -> Option<&T>

source

pub fn get_retained(&self, index: usize) -> Option<Retained<T>>
where T: IsIdCloneable,

source

pub fn get_mut(&mut self, index: usize) -> Option<&mut T>
where T: IsMutable,

source

pub fn first(&self) -> Option<&T>

source

pub fn first_retained(&self) -> Option<Retained<T>>
where T: IsIdCloneable,

source

pub fn first_mut(&mut self) -> Option<&mut T>
where T: IsMutable,

source

pub fn last(&self) -> Option<&T>

source

pub fn last_retained(&self) -> Option<Retained<T>>
where T: IsIdCloneable,

source

pub fn last_mut(&mut self) -> Option<&mut T>
where T: IsMutable,

source§

impl<T> NSArray<T>
where T: Message,

source

pub fn objects_in_range(&self, range: Range<usize>) -> Option<Vec<&T>>

source§

impl<ObjectType> NSArray<ObjectType>
where ObjectType: Message,

source

pub fn count(&self) -> usize

source

pub unsafe fn objectAtIndex(&self, index: usize) -> Retained<ObjectType>

source

pub fn init( this: Allocated<NSArray<ObjectType>>, ) -> Retained<NSArray<ObjectType>>

source

pub unsafe fn initWithObjects_count( this: Allocated<NSArray<ObjectType>>, objects: *mut NonNull<ObjectType>, cnt: usize, ) -> Retained<NSArray<ObjectType>>

source

pub unsafe fn initWithCoder( this: Allocated<NSArray<ObjectType>>, coder: &NSCoder, ) -> Option<Retained<NSArray<ObjectType>>>

source§

impl<ObjectType> NSArray<ObjectType>
where ObjectType: Message,

Methods declared on superclass NSObject

source

pub fn new() -> Retained<NSArray<ObjectType>>

source§

impl<ObjectType> NSArray<ObjectType>
where ObjectType: Message,

NSExtendedArray

source

pub unsafe fn arrayByAddingObject( &self, an_object: &ObjectType, ) -> Retained<NSArray<ObjectType>>

source

pub unsafe fn arrayByAddingObjectsFromArray( &self, other_array: &NSArray<ObjectType>, ) -> Retained<NSArray<ObjectType>>

source

pub unsafe fn componentsJoinedByString( &self, separator: &NSString, ) -> Retained<NSString>

source

pub unsafe fn containsObject(&self, an_object: &ObjectType) -> bool

source

pub unsafe fn description(&self) -> Retained<NSString>

source

pub unsafe fn descriptionWithLocale( &self, locale: Option<&AnyObject>, ) -> Retained<NSString>

source

pub unsafe fn descriptionWithLocale_indent( &self, locale: Option<&AnyObject>, level: usize, ) -> Retained<NSString>

source

pub unsafe fn firstObjectCommonWithArray( &self, other_array: &NSArray<ObjectType>, ) -> Option<Retained<ObjectType>>

source

pub unsafe fn getObjects_range( &self, objects: NonNull<NonNull<ObjectType>>, range: NSRange, )

source

pub unsafe fn indexOfObject(&self, an_object: &ObjectType) -> usize

source

pub unsafe fn indexOfObject_inRange( &self, an_object: &ObjectType, range: NSRange, ) -> usize

source

pub unsafe fn indexOfObjectIdenticalTo(&self, an_object: &ObjectType) -> usize

source

pub unsafe fn indexOfObjectIdenticalTo_inRange( &self, an_object: &ObjectType, range: NSRange, ) -> usize

source

pub unsafe fn isEqualToArray(&self, other_array: &NSArray<ObjectType>) -> bool

source

pub unsafe fn firstObject(&self) -> Option<Retained<ObjectType>>

source

pub unsafe fn lastObject(&self) -> Option<Retained<ObjectType>>

source

pub unsafe fn sortedArrayHint(&self) -> Retained<NSData>

source

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>>

source

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>>

source

pub unsafe fn sortedArrayUsingSelector( &self, comparator: Sel, ) -> Retained<NSArray<ObjectType>>

source

pub unsafe fn subarrayWithRange( &self, range: NSRange, ) -> Retained<NSArray<ObjectType>>

source

pub unsafe fn writeToURL_error( &self, url: &NSURL, ) -> Result<(), Retained<NSError>>

source

pub unsafe fn makeObjectsPerformSelector(&self, a_selector: Sel)

source

pub unsafe fn makeObjectsPerformSelector_withObject( &self, a_selector: Sel, argument: Option<&AnyObject>, )

source

pub unsafe fn objectAtIndexedSubscript( &self, idx: usize, ) -> Retained<ObjectType>

source§

impl<ObjectType> NSArray<ObjectType>
where ObjectType: Message,

NSArrayCreation

source

pub unsafe fn array() -> Retained<NSArray<ObjectType>>

source

pub unsafe fn arrayWithObject( an_object: &ObjectType, ) -> Retained<NSArray<ObjectType>>

source

pub unsafe fn arrayWithObjects_count( objects: NonNull<NonNull<ObjectType>>, cnt: usize, ) -> Retained<NSArray<ObjectType>>

source

pub unsafe fn arrayWithArray( array: &NSArray<ObjectType>, ) -> Retained<NSArray<ObjectType>>

source

pub unsafe fn initWithArray( this: Allocated<NSArray<ObjectType>>, array: &NSArray<ObjectType>, ) -> Retained<NSArray<ObjectType>>

source

pub unsafe fn initWithArray_copyItems( this: Allocated<NSArray<ObjectType>>, array: &NSArray<ObjectType>, flag: bool, ) -> Retained<NSArray<ObjectType>>

source

pub unsafe fn initWithContentsOfURL_error( this: Allocated<NSArray<ObjectType>>, url: &NSURL, ) -> Result<Retained<NSArray<ObjectType>>, Retained<NSError>>

source

pub unsafe fn arrayWithContentsOfURL_error( url: &NSURL, ) -> Result<Retained<NSArray<ObjectType>>, Retained<NSError>>

source§

impl<ObjectType> NSArray<ObjectType>
where ObjectType: Message,

This impl block contains no items.

NSArrayDiffing

source§

impl<ObjectType> NSArray<ObjectType>
where ObjectType: Message,

NSDeprecated

source

pub unsafe fn getObjects(&self, objects: NonNull<NonNull<ObjectType>>)

👎Deprecated: Use -getObjects:range: instead
source

pub unsafe fn arrayWithContentsOfFile( path: &NSString, ) -> Option<Retained<NSArray<ObjectType>>>

👎Deprecated
source

pub unsafe fn arrayWithContentsOfURL( url: &NSURL, ) -> Option<Retained<NSArray<ObjectType>>>

👎Deprecated
source

pub unsafe fn initWithContentsOfFile( this: Allocated<NSArray<ObjectType>>, path: &NSString, ) -> Option<Retained<NSArray<ObjectType>>>

👎Deprecated
source

pub unsafe fn initWithContentsOfURL( this: Allocated<NSArray<ObjectType>>, url: &NSURL, ) -> Option<Retained<NSArray<ObjectType>>>

👎Deprecated
source

pub unsafe fn writeToFile_atomically( &self, path: &NSString, use_auxiliary_file: bool, ) -> bool

👎Deprecated
source

pub unsafe fn writeToURL_atomically( &self, url: &NSURL, atomically: bool, ) -> bool

👎Deprecated

Methods from Deref<Target = NSObject>§

source

pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !

Handle messages the object doesn’t recognize.

See Apple’s documentation for details.

Methods from Deref<Target = AnyObject>§

source

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());
source

pub unsafe fn get_ivar<T>(&self, name: &str) -> &T
where T: Encode,

👎Deprecated: this is difficult to use correctly, use 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.

source

pub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut T
where T: Encode,

👎Deprecated: this is difficult to use correctly, use 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> AsMut<AnyObject> for NSArray<ObjectType>
where ObjectType: Message + ?Sized,

source§

fn as_mut(&mut self) -> &mut AnyObject

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<ObjectType> AsMut<NSArray<ObjectType>> for NSArray<ObjectType>
where ObjectType: Message + ?Sized,

source§

fn as_mut(&mut self) -> &mut NSArray<ObjectType>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<ObjectType> AsMut<NSObject> for NSArray<ObjectType>
where ObjectType: Message + ?Sized,

source§

fn as_mut(&mut self) -> &mut NSObject

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<ObjectType> AsRef<AnyObject> for NSArray<ObjectType>
where ObjectType: Message + ?Sized,

source§

fn as_ref(&self) -> &AnyObject

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<ObjectType> AsRef<NSArray<ObjectType>> for NSArray<ObjectType>
where ObjectType: Message + ?Sized,

source§

fn as_ref(&self) -> &NSArray<ObjectType>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<ObjectType> AsRef<NSObject> for NSArray<ObjectType>
where ObjectType: Message + ?Sized,

source§

fn as_ref(&self) -> &NSObject

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<ObjectType> Borrow<AnyObject> for NSArray<ObjectType>
where ObjectType: Message + ?Sized,

source§

fn borrow(&self) -> &AnyObject

Immutably borrows from an owned value. Read more
source§

impl<ObjectType> Borrow<NSObject> for NSArray<ObjectType>
where ObjectType: Message + ?Sized,

source§

fn borrow(&self) -> &NSObject

Immutably borrows from an owned value. Read more
source§

impl<ObjectType> BorrowMut<AnyObject> for NSArray<ObjectType>
where ObjectType: Message + ?Sized,

source§

fn borrow_mut(&mut self) -> &mut AnyObject

Mutably borrows from an owned value. Read more
source§

impl<ObjectType> BorrowMut<NSObject> for NSArray<ObjectType>
where ObjectType: Message + ?Sized,

source§

fn borrow_mut(&mut self) -> &mut NSObject

Mutably borrows from an owned value. Read more
source§

impl<ObjectType> ClassType for NSArray<ObjectType>
where ObjectType: Message + ?Sized,

source§

const NAME: &'static str = "NSArray"

The name of the Objective-C class that this type represents. Read more
source§

type Super = NSObject

The superclass of this class. Read more
source§

type Mutability = ImmutableWithMutableSubclass<NSMutableArray<ObjectType>>

Whether the type is mutable or immutable. Read more
source§

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

Get an immutable reference to the superclass.
source§

fn as_super_mut(&mut self) -> &mut <NSArray<ObjectType> as ClassType>::Super

Get a mutable reference to the superclass.
source§

fn alloc() -> Allocated<Self>

Allocate a new instance of the class. Read more
source§

impl<ObjectType> DefaultRetained for NSArray<ObjectType>
where ObjectType: Message,

source§

fn default_id() -> Retained<NSArray<ObjectType>>

The default Retained for a type. Read more
source§

fn default_retained() -> Retained<Self>

The default Retained for a type. Read more
source§

impl<ObjectType> Deref for NSArray<ObjectType>
where ObjectType: Message + ?Sized,

source§

type Target = NSObject

The resulting type after dereferencing.
source§

fn deref(&self) -> &<NSArray<ObjectType> as Deref>::Target

Dereferences the value.
source§

impl<ObjectType> DerefMut for NSArray<ObjectType>
where ObjectType: Message + ?Sized,

source§

fn deref_mut(&mut self) -> &mut <NSArray<ObjectType> as Deref>::Target

Mutably dereferences the value.
source§

impl<ObjectType> Hash for NSArray<ObjectType>
where ObjectType: Hash + ?Sized,

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T> Index<usize> for NSArray<T>
where T: Message,

source§

type Output = T

The returned type after indexing.
source§

fn index(&self, index: usize) -> &T

Performs the indexing (container[index]) operation. Read more
source§

impl<T> IndexMut<usize> for NSArray<T>
where T: Message + IsMutable,

source§

fn index_mut(&mut self, index: usize) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<ObjectType> PartialEq for NSArray<ObjectType>
where ObjectType: PartialEq + ?Sized,

source§

fn eq(&self, other: &NSArray<ObjectType>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<ObjectType> RefEncode for NSArray<ObjectType>
where ObjectType: Message + ?Sized,

source§

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,

source§

fn id_from_iter<I>(iter: I) -> Retained<NSArray<T>>
where I: IntoIterator<Item = &'a T>,

Creates an Retained from an iterator. Read more
source§

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,

source§

fn id_from_iter<I>(iter: I) -> Retained<NSArray<T>>
where I: IntoIterator<Item = Retained<T>>,

Creates an Retained from an iterator. Read more
source§

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>

source§

type Owned = Retained<NSArray<T>>

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> <NSArray<T> as ToOwned>::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<ObjectType> Eq for NSArray<ObjectType>
where ObjectType: Eq + ?Sized,

source§

impl<ObjectType> Message for NSArray<ObjectType>
where ObjectType: Message + ?Sized,

source§

impl<ObjectType> NSCoding for NSArray<ObjectType>
where ObjectType: NSCoding + ?Sized,

source§

impl<ObjectType> NSCopying for NSArray<ObjectType>
where ObjectType: IsIdCloneable + ?Sized,

source§

impl<ObjectType> NSMutableCopying for NSArray<ObjectType>
where ObjectType: IsIdCloneable + ?Sized,

source§

impl<ObjectType> NSObjectProtocol for NSArray<ObjectType>
where ObjectType: ?Sized,

source§

impl<ObjectType> NSSecureCoding for NSArray<ObjectType>
where ObjectType: NSSecureCoding + ?Sized,

source§

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>
where ObjectType: RefUnwindSafe + UnwindSafe + ?Sized,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,