Trait number_general::NumberInstance[][src]

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

Defines common operations on numeric types supported by Number.

Associated Types

Loading content...

Required methods

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

Get an impl of NumberClass describing this number.

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

Cast this number into the specified NumberClass.

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

Calculate the absolute value of this number.

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

Raise this number to the given exponent.

Loading content...

Provided methods

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

Return true if self and other are nonzero.

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

Return true if this number is zero.

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

Return true if self or other is nonzero.

fn xor(self, other: Self) -> Self where
    Boolean: CastFrom<Self>, 
[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

fn class(&self) -> ComplexType[src]

fn into_type(self, dtype: ComplexType) -> Complex[src]

fn abs(self) -> Float[src]

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

impl NumberInstance for Float[src]

type Abs = Float

type Exp = Self

type Class = FloatType

fn class(&self) -> FloatType[src]

fn into_type(self, dtype: FloatType) -> Float[src]

fn abs(self) -> Float[src]

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

impl NumberInstance for Int[src]

type Abs = Self

type Exp = UInt

type Class = IntType

fn class(&self) -> IntType[src]

fn into_type(self, dtype: IntType) -> Int[src]

fn abs(self) -> Self[src]

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

impl NumberInstance for Number[src]

type Abs = Number

type Exp = Self

type Class = NumberType

fn class(&self) -> NumberType[src]

fn into_type(self, dtype: NumberType) -> Number[src]

fn abs(self) -> Number[src]

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

impl NumberInstance for UInt[src]

type Abs = Self

type Exp = Self

type Class = UIntType

fn class(&self) -> UIntType[src]

fn into_type(self, dtype: UIntType) -> UInt[src]

fn abs(self) -> UInt[src]

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

impl NumberInstance for Boolean[src]

type Abs = Self

type Exp = Self

type Class = BooleanType

fn class(&self) -> BooleanType[src]

fn into_type(self, _dtype: BooleanType) -> Boolean[src]

fn abs(self) -> Self[src]

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

fn and(self, other: Self) -> Self[src]

fn not(self) -> Self[src]

fn or(self, other: Self) -> Self[src]

fn xor(self, other: Self) -> Self[src]

Loading content...