Struct icrate::Foundation::NSArray
source · #[repr(C)]pub struct NSArray<ObjectType: Message = AnyObject> { /* private fields */ }Foundation and Foundation_NSArray only.Implementations§
impl NSArray
CKRecordValue
source§impl<T: Message> NSArray<T>
impl<T: Message> NSArray<T>
pub fn from_vec(vec: Vec<Id<T>>) -> Id<Self>
pub fn from_id_slice(slice: &[Id<T>]) -> Id<Self>where T: IsIdCloneable,
pub fn from_slice(slice: &[&T]) -> Id<Self>where T: IsRetainable,
pub fn to_vec(&self) -> Vec<&T>
pub fn to_vec_retained(&self) -> Vec<Id<T>>where T: IsIdCloneable,
source§impl<T: Message> NSArray<T>
impl<T: Message> NSArray<T>
pub fn get(&self, index: usize) -> Option<&T>
pub fn get_retained(&self, index: usize) -> Option<Id<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<Id<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<Id<T>>where T: IsIdCloneable,
pub fn last_mut(&mut self) -> Option<&mut T>where T: IsMutable,
source§impl<T: Message> NSArray<T>
impl<T: Message> NSArray<T>
pub fn iter(&self) -> Iter<'_, T> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, T> ⓘwhere T: IsMutable,
pub fn iter_retained(&self) -> IterRetained<'_, T> ⓘwhere T: IsIdCloneable,
source§impl<ObjectType: Message> NSArray<ObjectType>
impl<ObjectType: Message> NSArray<ObjectType>
pub fn count(&self) -> NSUInteger
pub unsafe fn objectAtIndex(&self, index: NSUInteger) -> Id<ObjectType>
pub fn init(this: Option<Allocated<Self>>) -> Id<Self>
pub unsafe fn initWithObjects_count( this: Option<Allocated<Self>>, objects: *mut NonNull<ObjectType>, cnt: NSUInteger ) -> Id<Self>
pub unsafe fn initWithCoder( this: Option<Allocated<Self>>, coder: &NSCoder ) -> Option<Id<Self>>
Foundation_NSCoder only.source§impl<ObjectType: Message> NSArray<ObjectType>
impl<ObjectType: Message> NSArray<ObjectType>
NSExtendedArray
pub unsafe fn arrayByAddingObject( &self, an_object: &ObjectType ) -> Id<NSArray<ObjectType>>
pub unsafe fn arrayByAddingObjectsFromArray( &self, other_array: &NSArray<ObjectType> ) -> Id<NSArray<ObjectType>>
pub unsafe fn componentsJoinedByString( &self, separator: &NSString ) -> Id<NSString>
Foundation_NSString only.pub unsafe fn containsObject(&self, an_object: &ObjectType) -> bool
pub unsafe fn description(&self) -> Id<NSString>
Foundation_NSString only.pub unsafe fn descriptionWithLocale( &self, locale: Option<&AnyObject> ) -> Id<NSString>
Foundation_NSString only.pub unsafe fn descriptionWithLocale_indent( &self, locale: Option<&AnyObject>, level: NSUInteger ) -> Id<NSString>
Foundation_NSString only.pub unsafe fn firstObjectCommonWithArray( &self, other_array: &NSArray<ObjectType> ) -> Option<Id<ObjectType>>
pub unsafe fn getObjects_range( &self, objects: NonNull<NonNull<ObjectType>>, range: NSRange )
pub unsafe fn indexOfObject(&self, an_object: &ObjectType) -> NSUInteger
pub unsafe fn indexOfObject_inRange( &self, an_object: &ObjectType, range: NSRange ) -> NSUInteger
pub unsafe fn indexOfObjectIdenticalTo( &self, an_object: &ObjectType ) -> NSUInteger
pub unsafe fn indexOfObjectIdenticalTo_inRange( &self, an_object: &ObjectType, range: NSRange ) -> NSUInteger
pub unsafe fn isEqualToArray(&self, other_array: &NSArray<ObjectType>) -> bool
pub unsafe fn firstObject(&self) -> Option<Id<ObjectType>>
pub unsafe fn lastObject(&self) -> Option<Id<ObjectType>>
pub unsafe fn objectEnumerator(&self) -> Id<NSEnumerator<ObjectType>>
Foundation_NSEnumerator only.pub unsafe fn reverseObjectEnumerator(&self) -> Id<NSEnumerator<ObjectType>>
Foundation_NSEnumerator only.pub unsafe fn sortedArrayHint(&self) -> Id<NSData>
Foundation_NSData only.pub unsafe fn sortedArrayUsingFunction_context( &self, comparator: unsafe extern "C" fn(_: NonNull<ObjectType>, _: NonNull<ObjectType>, _: *mut c_void) -> NSInteger, context: *mut c_void ) -> Id<NSArray<ObjectType>>
pub unsafe fn sortedArrayUsingFunction_context_hint( &self, comparator: unsafe extern "C" fn(_: NonNull<ObjectType>, _: NonNull<ObjectType>, _: *mut c_void) -> NSInteger, context: *mut c_void, hint: Option<&NSData> ) -> Id<NSArray<ObjectType>>
Foundation_NSData only.pub unsafe fn sortedArrayUsingSelector( &self, comparator: Sel ) -> Id<NSArray<ObjectType>>
pub unsafe fn subarrayWithRange( &self, range: NSRange ) -> Id<NSArray<ObjectType>>
pub unsafe fn writeToURL_error(&self, url: &NSURL) -> Result<(), Id<NSError>>
Foundation_NSError and Foundation_NSURL only.pub unsafe fn makeObjectsPerformSelector(&self, a_selector: Sel)
pub unsafe fn makeObjectsPerformSelector_withObject( &self, a_selector: Sel, argument: Option<&AnyObject> )
pub unsafe fn objectsAtIndexes( &self, indexes: &NSIndexSet ) -> Id<NSArray<ObjectType>>
Foundation_NSIndexSet only.pub unsafe fn objectAtIndexedSubscript(&self, idx: NSUInteger) -> Id<ObjectType>
pub unsafe fn enumerateObjectsUsingBlock( &self, block: &Block<(NonNull<ObjectType>, NSUInteger, NonNull<Bool>), ()> )
pub unsafe fn enumerateObjectsWithOptions_usingBlock( &self, opts: NSEnumerationOptions, block: &Block<(NonNull<ObjectType>, NSUInteger, NonNull<Bool>), ()> )
pub unsafe fn enumerateObjectsAtIndexes_options_usingBlock( &self, s: &NSIndexSet, opts: NSEnumerationOptions, block: &Block<(NonNull<ObjectType>, NSUInteger, NonNull<Bool>), ()> )
Foundation_NSIndexSet only.pub unsafe fn indexOfObjectPassingTest( &self, predicate: &Block<(NonNull<ObjectType>, NSUInteger, NonNull<Bool>), Bool> ) -> NSUInteger
pub unsafe fn indexOfObjectWithOptions_passingTest( &self, opts: NSEnumerationOptions, predicate: &Block<(NonNull<ObjectType>, NSUInteger, NonNull<Bool>), Bool> ) -> NSUInteger
pub unsafe fn indexOfObjectAtIndexes_options_passingTest( &self, s: &NSIndexSet, opts: NSEnumerationOptions, predicate: &Block<(NonNull<ObjectType>, NSUInteger, NonNull<Bool>), Bool> ) -> NSUInteger
Foundation_NSIndexSet only.pub unsafe fn indexesOfObjectsPassingTest( &self, predicate: &Block<(NonNull<ObjectType>, NSUInteger, NonNull<Bool>), Bool> ) -> Id<NSIndexSet>
Foundation_NSIndexSet only.pub unsafe fn indexesOfObjectsWithOptions_passingTest( &self, opts: NSEnumerationOptions, predicate: &Block<(NonNull<ObjectType>, NSUInteger, NonNull<Bool>), Bool> ) -> Id<NSIndexSet>
Foundation_NSIndexSet only.pub unsafe fn indexesOfObjectsAtIndexes_options_passingTest( &self, s: &NSIndexSet, opts: NSEnumerationOptions, predicate: &Block<(NonNull<ObjectType>, NSUInteger, NonNull<Bool>), Bool> ) -> Id<NSIndexSet>
Foundation_NSIndexSet only.pub unsafe fn sortedArrayUsingComparator( &self, cmptr: NSComparator ) -> Id<NSArray<ObjectType>>
pub unsafe fn sortedArrayWithOptions_usingComparator( &self, opts: NSSortOptions, cmptr: NSComparator ) -> Id<NSArray<ObjectType>>
pub unsafe fn indexOfObject_inSortedRange_options_usingComparator( &self, obj: &ObjectType, r: NSRange, opts: NSBinarySearchingOptions, cmp: NSComparator ) -> NSUInteger
source§impl<ObjectType: Message> NSArray<ObjectType>
impl<ObjectType: Message> NSArray<ObjectType>
NSArrayCreation
pub unsafe fn array() -> Id<Self>
pub unsafe fn arrayWithObject(an_object: &ObjectType) -> Id<Self>
pub unsafe fn arrayWithObjects_count( objects: NonNull<NonNull<ObjectType>>, cnt: NSUInteger ) -> Id<Self>
pub unsafe fn arrayWithArray(array: &NSArray<ObjectType>) -> Id<Self>
pub unsafe fn initWithArray( this: Option<Allocated<Self>>, array: &NSArray<ObjectType> ) -> Id<Self>
pub unsafe fn initWithArray_copyItems( this: Option<Allocated<Self>>, array: &NSArray<ObjectType>, flag: bool ) -> Id<Self>
pub unsafe fn initWithContentsOfURL_error( this: Option<Allocated<Self>>, url: &NSURL ) -> Result<Id<NSArray<ObjectType>>, Id<NSError>>
Foundation_NSError and Foundation_NSURL only.pub unsafe fn arrayWithContentsOfURL_error( url: &NSURL ) -> Result<Id<NSArray<ObjectType>>, Id<NSError>>
Foundation_NSError and Foundation_NSURL only.source§impl<ObjectType: Message> NSArray<ObjectType>
impl<ObjectType: Message> NSArray<ObjectType>
NSArrayDiffing
pub unsafe fn differenceFromArray_withOptions_usingEquivalenceTest( &self, other: &NSArray<ObjectType>, options: NSOrderedCollectionDifferenceCalculationOptions, block: &Block<(NonNull<ObjectType>, NonNull<ObjectType>), Bool> ) -> Id<NSOrderedCollectionDifference<ObjectType>>
Foundation_NSOrderedCollectionDifference only.pub unsafe fn differenceFromArray_withOptions( &self, other: &NSArray<ObjectType>, options: NSOrderedCollectionDifferenceCalculationOptions ) -> Id<NSOrderedCollectionDifference<ObjectType>>
Foundation_NSOrderedCollectionDifference only.pub unsafe fn differenceFromArray( &self, other: &NSArray<ObjectType> ) -> Id<NSOrderedCollectionDifference<ObjectType>>
Foundation_NSOrderedCollectionDifference only.pub unsafe fn arrayByApplyingDifference( &self, difference: &NSOrderedCollectionDifference<ObjectType> ) -> Option<Id<NSArray<ObjectType>>>
Foundation_NSOrderedCollectionDifference only.source§impl<ObjectType: Message> NSArray<ObjectType>
impl<ObjectType: Message> NSArray<ObjectType>
NSDeprecated
pub unsafe fn getObjects(&self, objects: NonNull<NonNull<ObjectType>>)
pub unsafe fn arrayWithContentsOfFile( path: &NSString ) -> Option<Id<NSArray<ObjectType>>>
Foundation_NSString only.pub unsafe fn arrayWithContentsOfURL( url: &NSURL ) -> Option<Id<NSArray<ObjectType>>>
Foundation_NSURL only.pub unsafe fn initWithContentsOfFile( this: Option<Allocated<Self>>, path: &NSString ) -> Option<Id<NSArray<ObjectType>>>
Foundation_NSString only.pub unsafe fn initWithContentsOfURL( this: Option<Allocated<Self>>, url: &NSURL ) -> Option<Id<NSArray<ObjectType>>>
Foundation_NSURL only.pub unsafe fn writeToFile_atomically( &self, path: &NSString, use_auxiliary_file: bool ) -> bool
Foundation_NSString only.pub unsafe fn writeToURL_atomically( &self, url: &NSURL, atomically: bool ) -> bool
Foundation_NSURL only.source§impl<ObjectType: Message> NSArray<ObjectType>
impl<ObjectType: Message> NSArray<ObjectType>
NSKeyValueCoding
pub unsafe fn valueForKey(&self, key: &NSString) -> Id<AnyObject>
Foundation_NSString only.pub unsafe fn setValue_forKey(&self, value: Option<&AnyObject>, key: &NSString)
Foundation_NSString only.source§impl<ObjectType: Message> NSArray<ObjectType>
impl<ObjectType: Message> NSArray<ObjectType>
NSKeyValueObserverRegistration
pub unsafe fn addObserver_toObjectsAtIndexes_forKeyPath_options_context( &self, observer: &NSObject, indexes: &NSIndexSet, key_path: &NSString, options: NSKeyValueObservingOptions, context: *mut c_void )
Foundation_NSIndexSet and Foundation_NSString only.pub unsafe fn removeObserver_fromObjectsAtIndexes_forKeyPath_context( &self, observer: &NSObject, indexes: &NSIndexSet, key_path: &NSString, context: *mut c_void )
Foundation_NSIndexSet and Foundation_NSString only.pub unsafe fn removeObserver_fromObjectsAtIndexes_forKeyPath( &self, observer: &NSObject, indexes: &NSIndexSet, key_path: &NSString )
Foundation_NSIndexSet and Foundation_NSString only.pub unsafe fn addObserver_forKeyPath_options_context( &self, observer: &NSObject, key_path: &NSString, options: NSKeyValueObservingOptions, context: *mut c_void )
Foundation_NSString only.pub unsafe fn removeObserver_forKeyPath_context( &self, observer: &NSObject, key_path: &NSString, context: *mut c_void )
Foundation_NSString only.pub unsafe fn removeObserver_forKeyPath( &self, observer: &NSObject, key_path: &NSString )
Foundation_NSString only.source§impl<ObjectType: Message> NSArray<ObjectType>
impl<ObjectType: Message> NSArray<ObjectType>
NSPredicateSupport
pub unsafe fn filteredArrayUsingPredicate( &self, predicate: &NSPredicate ) -> Id<NSArray<ObjectType>>
Foundation_NSPredicate only.source§impl<ObjectType: Message> NSArray<ObjectType>
impl<ObjectType: Message> NSArray<ObjectType>
NSSortDescriptorSorting
pub unsafe fn sortedArrayUsingDescriptors( &self, sort_descriptors: &NSArray<NSSortDescriptor> ) -> Id<NSArray<ObjectType>>
Foundation_NSSortDescriptor only.Methods from Deref<Target = AnyObject>§
sourcepub unsafe fn ivar_ptr<T>(&self, name: &str) -> *mut Twhere
T: Encode,
pub unsafe fn ivar_ptr<T>(&self, name: &str) -> *mut Twhere T: Encode,
Returns a pointer to the instance variable / ivar with the given name.
This is similar to UnsafeCell::get, see that for more information
on what is and isn’t safe to do.
Usually you will have defined the instance variable yourself with
ClassBuilder::add_ivar, the type of the ivar T must match the
type used in that.
Attempting to access or modify private implementation details of a class that you do no control using this is not supported, and may invoke undefined behaviour.
Library implementors are strongly encouraged to expose a safe interface to the ivar.
Panics
May panic if the object has no ivar with the given name. May also
panic if the type encoding of the ivar differs from the type encoding
of T.
This should purely seen as help while debugging and is not guaranteed
(e.g. it may be disabled when debug_assertions are off).
Safety
The object must have an instance variable with the given name, and it
must be of type T. Any invariants that the object have assumed about
the value of the instance variable must not be violated.
No thread syncronization is done on accesses to the variable, so you must ensure that any access to the returned pointer do not cause data races, and that Rust’s mutability rules are not otherwise violated.
sourcepub unsafe fn ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
pub unsafe fn ivar<T>(&self, name: &str) -> &Twhere T: Encode,
Returns a reference to the instance variable with the given name.
See AnyObject::ivar_ptr for more information, including on when
this panics.
Safety
The object must have an instance variable with the given name, and it
must be of type T.
No thread syncronization is done, so you must ensure that no other
thread is concurrently mutating the variable. This requirement can be
considered upheld if all mutation happens through
AnyObject::ivar_mut (since that takes &mut self).
sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
👎Deprecated: Use AnyObject::ivar instead.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere T: Encode,
AnyObject::ivar instead.sourcepub unsafe fn ivar_mut<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
pub unsafe fn ivar_mut<T>(&mut self, name: &str) -> &mut Twhere T: Encode,
Returns a mutable reference to the ivar with the given name.
See AnyObject::ivar_ptr for more information, including on when
this panics.
Safety
The object must have an instance variable with the given name, and it
must be of type T.
This access happens through &mut self, which means we know it to be
the only reference, hence you do not need to do any work to ensure
that data races do not happen.
sourcepub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
👎Deprecated: Use AnyObject::ivar_mut instead.
pub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere T: Encode,
AnyObject::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.
This is a shorthand for AnyObject::ivar_mut, see that for more
information.
Safety
Same as AnyObject::ivar_mut.
Trait Implementations§
source§impl<ObjectType: Message> BorrowMut<AnyObject> for NSArray<ObjectType>
impl<ObjectType: Message> BorrowMut<AnyObject> for NSArray<ObjectType>
source§fn borrow_mut(&mut self) -> &mut AnyObject
fn borrow_mut(&mut self) -> &mut AnyObject
source§impl<ObjectType: Message> BorrowMut<NSArray<ObjectType>> for NSMutableArray<ObjectType>
impl<ObjectType: Message> BorrowMut<NSArray<ObjectType>> for NSMutableArray<ObjectType>
source§fn borrow_mut(&mut self) -> &mut NSArray<ObjectType>
fn borrow_mut(&mut self) -> &mut NSArray<ObjectType>
source§impl<ObjectType: Message> BorrowMut<NSObject> for NSArray<ObjectType>
impl<ObjectType: Message> BorrowMut<NSObject> for NSArray<ObjectType>
source§fn borrow_mut(&mut self) -> &mut NSObject
fn borrow_mut(&mut self) -> &mut NSObject
source§impl<ObjectType: Message> ClassType for NSArray<ObjectType>
impl<ObjectType: Message> ClassType for NSArray<ObjectType>
§type Mutability = ImmutableWithMutableSubclass<NSMutableArray<ObjectType>>
type Mutability = ImmutableWithMutableSubclass<NSMutableArray<ObjectType>>
source§const NAME: &'static str = _
const NAME: &'static str = _
source§fn class() -> &'static AnyClass
fn class() -> &'static AnyClass
source§fn as_super_mut(&mut self) -> &mut Self::Super
fn as_super_mut(&mut self) -> &mut Self::Super
source§impl<'a, T: IsRetainable + 'a> IdFromIterator<&'a T> for NSArray<T>
impl<'a, T: IsRetainable + 'a> IdFromIterator<&'a T> for NSArray<T>
source§fn id_from_iter<I: IntoIterator<Item = &'a T>>(iter: I) -> Id<Self>
fn id_from_iter<I: IntoIterator<Item = &'a T>>(iter: I) -> Id<Self>
Id from an iterator.source§impl<T: Message> IdFromIterator<Id<T>> for NSArray<T>
impl<T: Message> IdFromIterator<Id<T>> for NSArray<T>
source§fn id_from_iter<I: IntoIterator<Item = Id<T>>>(iter: I) -> Id<Self>
fn id_from_iter<I: IntoIterator<Item = Id<T>>>(iter: I) -> Id<Self>
Id from an iterator.source§impl<T: IsIdCloneable> IdIntoIterator for NSArray<T>
impl<T: IsIdCloneable> IdIntoIterator for NSArray<T>
source§impl<'a, T: Message> IntoIterator for &'a NSArray<T>
impl<'a, T: Message> IntoIterator for &'a NSArray<T>
source§impl<'a, T: IsMutable> IntoIterator for &'a mut NSArray<T>
impl<'a, T: IsMutable> IntoIterator for &'a mut NSArray<T>
source§impl<ObjectType: Message + NSCoding> NSCoding for NSArray<ObjectType>
impl<ObjectType: Message + NSCoding> NSCoding for NSArray<ObjectType>
source§impl<ObjectType: Message> NSFastEnumeration for NSArray<ObjectType>
impl<ObjectType: Message> NSFastEnumeration for NSArray<ObjectType>
unsafe fn countByEnumeratingWithState_objects_count( &self, state: NonNull<NSFastEnumerationState>, buffer: NonNull<*mut AnyObject>, len: NSUInteger ) -> NSUIntegerwhere Self: Sized + Message,
source§impl<ObjectType: Message> NSObjectProtocol for NSArray<ObjectType>
impl<ObjectType: Message> NSObjectProtocol for NSArray<ObjectType>
source§impl<ObjectType: Message + NSSecureCoding> NSSecureCoding for NSArray<ObjectType>
impl<ObjectType: Message + NSSecureCoding> NSSecureCoding for NSArray<ObjectType>
source§impl<ObjectType: PartialEq + Message> PartialEq<NSArray<ObjectType>> for NSArray<ObjectType>
impl<ObjectType: PartialEq + Message> PartialEq<NSArray<ObjectType>> for NSArray<ObjectType>
source§impl<ObjectType: Message> RefEncode for NSArray<ObjectType>
impl<ObjectType: Message> 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
source§impl<T: IsIdCloneable> ToOwned for NSArray<T>
impl<T: IsIdCloneable> ToOwned for NSArray<T>
impl CKRecordValue for NSArray
CloudKit only.