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) -> Intwhere
Self: Debug,
pub fn expect_int(self) -> Intwhere
Self: Debug,
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) -> f64where
Self: Debug,
pub fn expect_float(self) -> f64where
Self: Debug,
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>
impl 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