Trait tc_value::NumberInstance[][src]

pub trait NumberInstance: Into<Number> + From<Boolean> + Default + Copy + Add<Self, Output = Self> + Sub<Self, Output = Self> + Mul<Self, Output = Self> + Div<Self, Output = Self> + AddAssign<Self> + SubAssign<Self> + MulAssign<Self> + DivAssign<Self> + Sum<Self> + Product<Self> + Debug + Display {
    type Abs: NumberInstance;
    type Exp: NumberInstance;
    type Class: NumberClass;
    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
        Boolean: CastFrom<Self>
, { ... } }

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
    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 = Complex

type Class = ComplexType

impl NumberInstance for Float[src]

type Abs = Float

type Exp = Float

type Class = FloatType

impl NumberInstance for Int[src]

type Abs = Int

type Exp = UInt

type Class = IntType

impl NumberInstance for Number[src]

type Abs = Number

type Exp = Number

type Class = NumberType

impl NumberInstance for UInt[src]

type Abs = UInt

type Exp = UInt

type Class = UIntType

impl NumberInstance for Boolean[src]

type Abs = Boolean

type Exp = Boolean

type Class = BooleanType

Loading content...