pub enum Num {
Int(i64),
Float(f64),
}Expand description
A Pine number: either an int or a float.
Variants§
Implementations§
Source§impl Num
impl Num
Sourcepub fn as_f64(self) -> f64
pub fn as_f64(self) -> f64
The value as a float, for computations that do not care about the type.
pub fn is_int(self) -> bool
Sourcepub fn max(self, other: Num) -> Num
pub fn max(self, other: Num) -> Num
The larger of two numbers, keeping the type Pine’s overloads specify.
Sourcepub fn min(self, other: Num) -> Num
pub fn min(self, other: Num) -> Num
The smaller of two numbers, keeping the type Pine’s overloads specify.
Sourcepub fn checked_div(self, other: Num) -> Option<Num>
pub fn checked_div(self, other: Num) -> Option<Num>
Division, or None for a zero divisor — Pine yields na rather than
erroring. Two ints divide as ints, so 15 / 2 is 7.
Sourcepub fn checked_rem(self, other: Num) -> Option<Num>
pub fn checked_rem(self, other: Num) -> Option<Num>
Remainder, or None for a zero divisor.
Trait Implementations§
impl Copy for Num
impl StructuralPartialEq for Num
Auto Trait Implementations§
impl Freeze for Num
impl RefUnwindSafe for Num
impl Send for Num
impl Sync for Num
impl Unpin for Num
impl UnsafeUnpin for Num
impl UnwindSafe for Num
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