pub enum Number {
Int(Int),
Float(f64),
Complex {
real: f64,
imag: f64,
},
}Variants§
Implementations§
Source§impl Number
impl Number
Sourcepub fn as_int(&self) -> Option<&Int>
pub fn as_int(&self) -> Option<&Int>
Returns Some if self is a reference of variant Int, and None otherwise.
Sourcepub fn as_mut_int(&mut self) -> Option<&mut Int>
pub fn as_mut_int(&mut self) -> Option<&mut Int>
Returns Some if self is a mutable reference of variant Int, and None otherwise.
Sourcepub fn expect_int(self) -> Int
pub fn expect_int(self) -> Int
Sourcepub fn as_float(&self) -> Option<&f64>
pub fn as_float(&self) -> Option<&f64>
Returns Some if self is a reference of variant Float, and None otherwise.
Sourcepub fn as_mut_float(&mut self) -> Option<&mut f64>
pub fn as_mut_float(&mut self) -> Option<&mut f64>
Returns Some if self is a mutable reference of variant Float, and None otherwise.
Sourcepub fn expect_float(self) -> f64
pub fn expect_float(self) -> f64
Sourcepub fn float(self) -> Option<f64>
pub fn float(self) -> Option<f64>
Returns Some if self is of variant Float, and None otherwise.
Sourcepub const fn is_complex(&self) -> bool
pub const fn is_complex(&self) -> bool
Returns true if self is of variant Complex.
Trait Implementations§
Source§impl<'a> From<&'a Number> for ComparableNumber<'a>
impl<'a> From<&'a Number> for ComparableNumber<'a>
Source§fn from(number: &'a Number) -> ComparableNumber<'a>
fn from(number: &'a Number) -> ComparableNumber<'a>
Converts to this type from the input type.
Source§impl GetSize for Number
impl GetSize for Number
Source§fn get_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
Determines how many bytes this object occupies inside the heap. Read more
Source§fn get_heap_size_with_tracker<TRACKER>(
&self,
tracker: TRACKER,
) -> (usize, TRACKER)where
TRACKER: GetSizeTracker,
fn get_heap_size_with_tracker<TRACKER>(
&self,
tracker: TRACKER,
) -> (usize, TRACKER)where
TRACKER: GetSizeTracker,
Determines how many bytes this object occupies inside the heap while using a
tracker. Read moreSource§fn get_stack_size() -> usize
fn get_stack_size() -> usize
Determines how may bytes this object occupies inside the stack. Read more
Source§fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
Determines the total size of the object while using a
tracker. Read moreimpl StructuralPartialEq for Number
Auto Trait Implementations§
impl Freeze for Number
impl RefUnwindSafe for Number
impl Send for Number
impl Sync for Number
impl Unpin for Number
impl UnsafeUnpin for Number
impl UnwindSafe for Number
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more