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

Wrapper for a NSNumber object.

In general we strive to avoid using this in the codebase, but it’s a requirement for moving objects in and out of certain situations (e.g, UserDefaults).

Tuple Fields

0: Id<Object>

Implementations

If we’re vended an NSNumber from a method (e.g, NSUserDefaults querying) we might want to wrap (and retain) it while we figure out what to do with it. This does that.

If we’re vended an NSNumber from a method (e.g, NSUserDefaults querying) we might want to wrap it while we figure out what to do with it. This does that.

Constructs a numberWithBool instance of NSNumber and retains it.

Constructs a numberWithInteger instance of NSNumber and retains it.

Constructs a numberWithDouble instance of NSNumber and retains it.

Returns the objCType of the underlying NSNumber as a Rust &str. This flag can be used to inform you how you should pull the underlying data out of the NSNumber.

For more information: https://nshipster.com/type-encodings/

Pulls the underlying NSInteger value out and passes it back as an i64.

Note that this does not check if the underlying type is actually this. You are responsible for doing so via the objc_type() method.

Pulls the underlying double value out and passes it back as an f64.

Note that this does not check if the underlying type is actually this. You are responsible for doing so via the objc_type() method.

Pulls the underlying BOOL value out and passes it back as a bool.

Note that this does not check if the underlying type is actually this. You are responsible for doing so via the objc_type() method.

A helper method for determining if a given NSObject is an NSNumber.

Trait Implementations

Formats the value using the given formatter. Read more

Consumes and returns the underlying NSNumber.

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.