Trait rsc::Num

source ·
pub trait Num: Debug + Clone + PartialEq + PartialOrd + FromStr + Add<Output = Self> + Sub<Output = Self> + Mul<Output = Self> + Div<Output = Self> + Rem<Output = Self> + Neg<Output = Self> + AddAssign + SubAssign + MulAssign + DivAssign {
    // Required methods
    fn zero() -> Self;
    fn one() -> Self;
    fn is_whole(&self) -> bool;
    fn pow(self, other: Self) -> Self;
}
Expand description

Defines the minimum operations and definitions to parse and evaluate expressions.

Required Methods§

source

fn zero() -> Self

Returns the additive identity value, 0, for the number.

source

fn one() -> Self

Returns the multiplicative identity value, 1, for the number.

source

fn is_whole(&self) -> bool

Returns true if the number is a whole integer without a fractional part. E.g. 1 or 3.

source

fn pow(self, other: Self) -> Self

Returns number to the power of other.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Num for f32

source§

fn zero() -> Self

source§

fn one() -> Self

source§

fn is_whole(&self) -> bool

source§

fn pow(self, other: Self) -> Self

source§

impl Num for f64

source§

fn zero() -> Self

source§

fn one() -> Self

source§

fn is_whole(&self) -> bool

source§

fn pow(self, other: Self) -> Self

source§

impl Num for i8

source§

fn zero() -> Self

source§

fn one() -> Self

source§

fn is_whole(&self) -> bool

source§

fn pow(self, other: Self) -> Self

source§

impl Num for i16

source§

fn zero() -> Self

source§

fn one() -> Self

source§

fn is_whole(&self) -> bool

source§

fn pow(self, other: Self) -> Self

source§

impl Num for i32

source§

fn zero() -> Self

source§

fn one() -> Self

source§

fn is_whole(&self) -> bool

source§

fn pow(self, other: Self) -> Self

source§

impl Num for i64

source§

fn zero() -> Self

source§

fn one() -> Self

source§

fn is_whole(&self) -> bool

source§

fn pow(self, other: Self) -> Self

source§

impl Num for i128

source§

fn zero() -> Self

source§

fn one() -> Self

source§

fn is_whole(&self) -> bool

source§

fn pow(self, other: Self) -> Self

source§

impl Num for isize

source§

fn zero() -> Self

source§

fn one() -> Self

source§

fn is_whole(&self) -> bool

source§

fn pow(self, other: Self) -> Self

Implementors§