pub struct NSArray(pub Id<Object>);
Expand description

A wrapper for NSArray that makes common operations in our framework a bit easier to handle and reason about. This also provides a central place to look at replacing with CFArray if ever deemed necessary (unlikely, given how much Apple has optimized the Foundation classes, but still…).

Tuple Fields

0: Id<Object>

Implementations

Given a set of Objects, creates and retains an NSArray that holds them.

In some cases, we’re vended an NSArray by the system that we need to call retain on. This handles that case.

In some cases, we’re vended an NSArray by the system, and it’s ideal to not retain that. This handles that edge case.

Returns the count (len() equivalent) for the backing NSArray.

A helper method for mapping over the backing NSArray items and producing a Rust Vec<T>. Often times we need to map in this framework to convert between Rust types, so isolating this out makes life much easier.

Methods from Deref<Target = Object>

Returns the class of self.

Returns a reference to the ivar of self with the given name. Panics if self has no ivar with the given name. Unsafe because the caller must ensure that the ivar is actually of type T.

Returns a mutable reference to the ivar of self with the given name. Panics if self has no ivar with the given name. Unsafe because the caller must ensure that the ivar is actually of type T.

Sets the value of the ivar of self with the given name. Panics if self has no ivar with the given name. Unsafe because the caller must ensure that the ivar is actually of type T.

Trait Implementations

Formats the value using the given formatter. Read more

Derefs to the underlying Objective-C Object.

The resulting type after dereferencing.

Derefs to the underlying Objective-C Object.

Consumes and returns the pointer to the underlying NSArray.

Given a set of Objects, creates an NSArray that holds them.

Given a set of *mut Objects, creates an NSArray that holds them.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.