Trait tinychain::scalar::NumberInstance [−]
pub trait NumberInstance: Copy + Default + From<Boolean> + Into<Number> + Add<Self, Output = Self> + AddAssign<Self> + Sub<Self, Output = Self> + SubAssign<Self> + Mul<Self, Output = Self> + MulAssign<Self> + Div<Self, Output = Self> + DivAssign<Self> + Product<Self> + Sum<Self> + Debug + Display { type Abs: NumberInstance; type Exp: NumberInstance; type Class: NumberClass; 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>, { ... } }
Expand description
Defines common operations on numeric types supported by Number
.
Associated Types
Loading content...Required methods
fn class(&self) -> Self::Class
Expand description
Get an impl of NumberClass
describing this number.
fn into_type(self, dtype: Self::Class) -> <Self::Class as NumberClass>::Instance
Expand description
Cast this number into the specified NumberClass
.
fn abs(self) -> Self::Abs
Expand description
Calculate the absolute value of this number.
fn pow(self, exp: Self::Exp) -> Self
Expand description
Raise this number to the given exponent.
Provided methods
fn and(self, other: Self) -> Self where
Boolean: CastFrom<Self>,
Boolean: CastFrom<Self>,
Expand description
Return true
if self
and other
are nonzero.
fn not(self) -> Self where
Boolean: CastFrom<Self>,
Boolean: CastFrom<Self>,
Expand description
Return true
if this number is zero.
fn or(self, other: Self) -> Self where
Boolean: CastFrom<Self>,
Boolean: CastFrom<Self>,
Expand description
Return true
if self
or other
is nonzero.
fn xor(self, other: Self) -> Self where
Boolean: CastFrom<Self>,
Boolean: CastFrom<Self>,
Expand description
Return true
if exactly one of self
and other
is zero.
Implementors
impl NumberInstance for Complex
impl NumberInstance for Complex
impl NumberInstance for Float
impl NumberInstance for Float
impl NumberInstance for Int
impl NumberInstance for Int
impl NumberInstance for Number
impl NumberInstance for Number
impl NumberInstance for UInt
impl NumberInstance for UInt
impl NumberInstance for Boolean
impl NumberInstance for Boolean