#[repr(C)]pub struct NSNumber {
pub ptr: Id<Object>,
}Expand description
An object wrapper for primitive scalar numeric values.
Fields§
§ptr: Id<Object>The raw pointer to the Objective-C object.
Implementations§
Source§impl NSNumber
impl NSNumber
Sourcepub fn number_with_bool(value: bool) -> Self
pub fn number_with_bool(value: bool) -> Self
Sourcepub fn number_with_char(value: c_schar) -> Self
pub fn number_with_char(value: c_schar) -> Self
Sourcepub fn number_with_double(value: c_double) -> Self
pub fn number_with_double(value: c_double) -> Self
Sourcepub fn number_with_float(value: c_float) -> Self
pub fn number_with_float(value: c_float) -> Self
Sourcepub fn number_with_int(value: c_int) -> Self
pub fn number_with_int(value: c_int) -> Self
Sourcepub fn number_with_integer(value: Int) -> Self
pub fn number_with_integer(value: Int) -> Self
Sourcepub fn number_with_long(value: c_long) -> Self
pub fn number_with_long(value: c_long) -> Self
Sourcepub fn number_with_long_long(value: c_longlong) -> Self
pub fn number_with_long_long(value: c_longlong) -> Self
Sourcepub fn number_with_short(value: c_short) -> Self
pub fn number_with_short(value: c_short) -> Self
Sourcepub fn number_with_unsigned_char(value: c_uchar) -> Self
pub fn number_with_unsigned_char(value: c_uchar) -> Self
Sourcepub fn number_with_unsigned_int(value: c_uint) -> Self
pub fn number_with_unsigned_int(value: c_uint) -> Self
Sourcepub fn number_with_unsigned_integer(value: UInt) -> Self
pub fn number_with_unsigned_integer(value: UInt) -> Self
Sourcepub fn number_with_unsigned_long(value: c_ulong) -> Self
pub fn number_with_unsigned_long(value: c_ulong) -> Self
Sourcepub fn number_with_unsigned_long_long(value: c_ulonglong) -> Self
pub fn number_with_unsigned_long_long(value: c_ulonglong) -> Self
Sourcepub fn number_with_unsigned_short(value: c_ushort) -> Self
pub fn number_with_unsigned_short(value: c_ushort) -> Self
Sourcepub fn init_with_bool(&mut self, value: bool) -> Self
pub fn init_with_bool(&mut self, value: bool) -> Self
Returns an NSNumber object initialized to contain a given value, treated as a BOOL.
§Arguments
value- The value to store in the NSNumber object.
Sourcepub fn init_with_char(&mut self, value: c_schar) -> Self
pub fn init_with_char(&mut self, value: c_schar) -> Self
Sourcepub fn init_with_double(&mut self, value: c_double) -> Self
pub fn init_with_double(&mut self, value: c_double) -> Self
Sourcepub fn init_with_float(&mut self, value: c_float) -> Self
pub fn init_with_float(&mut self, value: c_float) -> Self
Sourcepub fn init_with_int(&mut self, value: c_int) -> Self
pub fn init_with_int(&mut self, value: c_int) -> Self
Sourcepub fn init_with_integer(&mut self, value: Int) -> Self
pub fn init_with_integer(&mut self, value: Int) -> Self
Sourcepub fn init_with_long(&mut self, value: c_long) -> Self
pub fn init_with_long(&mut self, value: c_long) -> Self
Sourcepub fn init_with_long_long(&mut self, value: c_longlong) -> Self
pub fn init_with_long_long(&mut self, value: c_longlong) -> Self
Sourcepub fn init_with_short(&mut self, value: c_short) -> Self
pub fn init_with_short(&mut self, value: c_short) -> Self
Sourcepub fn init_with_unsigned_char(&mut self, value: c_uchar) -> Self
pub fn init_with_unsigned_char(&mut self, value: c_uchar) -> Self
Sourcepub fn init_with_unsigned_int(&mut self, value: c_uint) -> Self
pub fn init_with_unsigned_int(&mut self, value: c_uint) -> Self
Sourcepub fn init_with_unsigned_integer(&mut self, value: c_uint) -> Self
pub fn init_with_unsigned_integer(&mut self, value: c_uint) -> Self
Sourcepub fn init_with_unsigned_long(&mut self, value: c_ulong) -> Self
pub fn init_with_unsigned_long(&mut self, value: c_ulong) -> Self
Sourcepub fn init_with_unsigned_long_long(&mut self, value: c_ulonglong) -> Self
pub fn init_with_unsigned_long_long(&mut self, value: c_ulonglong) -> Self
Sourcepub fn init_with_unsigned_short(&mut self, value: c_ushort) -> Self
pub fn init_with_unsigned_short(&mut self, value: c_ushort) -> Self
Sourcepub fn bool_value(&self) -> bool
pub fn bool_value(&self) -> bool
The number object’s value expressed as a Boolean value.
Sourcepub fn char_value(&self) -> c_schar
pub fn char_value(&self) -> c_schar
The number object’s value expressed as a char.
Sourcepub fn decimal_value(&self) -> NSDecimal
pub fn decimal_value(&self) -> NSDecimal
The number object’s value expressed as an NSDecimal structure.
Sourcepub fn double_value(&self) -> c_double
pub fn double_value(&self) -> c_double
The number object’s value expressed as a double, converted as necessary.
Sourcepub fn float_value(&self) -> c_float
pub fn float_value(&self) -> c_float
The number object’s value expressed as a float, converted as necessary.
Sourcepub fn int_value(&self) -> c_int
pub fn int_value(&self) -> c_int
The number object’s value expressed as an int, converted as necessary.
Sourcepub fn integer_value(&self) -> Int
pub fn integer_value(&self) -> Int
The number object’s value expressed as an NSInteger object, converted as necessary.
Sourcepub fn long_long_value(&self) -> c_longlong
pub fn long_long_value(&self) -> c_longlong
The number object’s value expressed as a long long, converted as necessary.
Sourcepub fn long_value(&self) -> c_long
pub fn long_value(&self) -> c_long
The number object’s value expressed as a long, converted as necessary.
Sourcepub fn short_value(&self) -> c_short
pub fn short_value(&self) -> c_short
The number object’s value expressed as a short, converted as necessary.
Sourcepub fn unsigned_char_value(&self) -> c_uchar
pub fn unsigned_char_value(&self) -> c_uchar
The number object’s value expressed as an unsigned char, converted as necessary.
Sourcepub fn unsigned_integer_value(&self) -> UInt
pub fn unsigned_integer_value(&self) -> UInt
The number object’s value expressed as an NSUInteger object, converted as necessary.
Sourcepub fn unsigned_int_value(&self) -> c_uint
pub fn unsigned_int_value(&self) -> c_uint
The number object’s value expressed as an unsigned int, converted as necessary.
Sourcepub fn unsigned_long_long_value(&self) -> c_ulonglong
pub fn unsigned_long_long_value(&self) -> c_ulonglong
The number object’s value expressed as an unsigned long long, converted as necessary.
Sourcepub fn unsigned_long_value(&self) -> c_ulong
pub fn unsigned_long_value(&self) -> c_ulong
The number object’s value expressed as an unsigned long, converted as necessary.
Sourcepub fn unsigned_short_value(&self) -> c_ushort
pub fn unsigned_short_value(&self) -> c_ushort
The number object’s value expressed as an unsigned short, converted as necessary.
Sourcepub fn description_with_locale(&self, locale: &NSLocale) -> NSString
pub fn description_with_locale(&self, locale: &NSLocale) -> NSString
Sourcepub fn string_value(&self) -> NSString
pub fn string_value(&self) -> NSString
The number object’s value expressed as a human-readable string.
Sourcepub fn compare(&self, other: &Self) -> NSComparisonResult
pub fn compare(&self, other: &Self) -> NSComparisonResult
Returns an NSComparisonResult value that indicates whether the number object’s value is greater than, equal to, or less than a given number.
§Arguments
other- The number to compare to the number object’s value.
Sourcepub fn is_equal_to_number(&self, other: &Self) -> bool
pub fn is_equal_to_number(&self, other: &Self) -> bool
Returns a Boolean value that indicates whether the number object’s value and a given number are equal.
§Arguments
other- The number to compare to the number object’s value.
Sourcepub fn objc_type(&self) -> *const char
pub fn objc_type(&self) -> *const char
Returns a C string containing the Objective-C type of the data contained in the number object.
§Return Value
A C string containing the Objective-C type of the data contained in the number object, as encoded by the @encode() compiler directive.
Sourcepub fn init_with_coder(&mut self, coder: &NSCoder) -> Self
pub fn init_with_coder(&mut self, coder: &NSCoder) -> Self
Methods from Deref<Target = Object>§
Sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
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.
Sourcepub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
pub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
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.