[][src]Trait number_general::NumberInstance

pub trait NumberInstance: Copy + Default + Sized + PartialOrd + From<Boolean> + Into<Number> + Add<Output = Self> + Sub<Output = Self> + Mul<Output = Self> + Div<Output = Self> + Product + Sum + Debug + Display {
    type Abs: NumberInstance;
    type Exp: NumberInstance;
    type Class: NumberClass<Instance = Self>;
    pub fn class(&self) -> Self::Class;
pub fn into_type(
        self,
        dtype: Self::Class
    ) -> <Self::Class as NumberClass>::Instance;
pub fn abs(self) -> Self::Abs;
pub fn pow(self, exp: Self::Exp) -> Self; pub fn and(self, other: Self) -> Self
    where
        Boolean: CastFrom<Self>
, { ... }
pub fn not(self) -> Self
    where
        Boolean: CastFrom<Self>
, { ... }
pub fn or(self, other: Self) -> Self
    where
        Boolean: CastFrom<Self>
, { ... }
pub fn xor(self, other: Self) -> Self
    where
        Self: CastInto<Boolean>
, { ... } }

Defines common operations on numeric types supported by Number.

Associated Types

Loading content...

Required methods

pub fn class(&self) -> Self::Class[src]

Get an impl of NumberClass describing this number.

pub fn into_type(
    self,
    dtype: Self::Class
) -> <Self::Class as NumberClass>::Instance
[src]

Cast this number into the specified NumberClass.

pub fn abs(self) -> Self::Abs[src]

Calculate the absolute value of this number.

pub fn pow(self, exp: Self::Exp) -> Self[src]

Raise this number to the given exponent.

Loading content...

Provided methods

pub fn and(self, other: Self) -> Self where
    Boolean: CastFrom<Self>, 
[src]

Return true if self and other are nonzero.

pub fn not(self) -> Self where
    Boolean: CastFrom<Self>, 
[src]

Return true if this number is zero.

pub fn or(self, other: Self) -> Self where
    Boolean: CastFrom<Self>, 
[src]

Return true if self or other is nonzero.

pub fn xor(self, other: Self) -> Self where
    Self: CastInto<Boolean>, 
[src]

Return true if exactly one of self and other is zero.

Loading content...

Implementors

impl NumberInstance for Complex[src]

type Abs = Float

type Exp = Self

type Class = ComplexType

impl NumberInstance for Float[src]

type Abs = Float

type Exp = Self

type Class = FloatType

impl NumberInstance for Int[src]

type Abs = Self

type Exp = UInt

type Class = IntType

impl NumberInstance for Number[src]

type Abs = Number

type Exp = Self

type Class = NumberType

impl NumberInstance for UInt[src]

type Abs = Self

type Exp = Self

type Class = UIntType

impl NumberInstance for Boolean[src]

type Abs = Self

type Exp = Self

type Class = BooleanType

Loading content...