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
type Abs: NumberInstance
[src]
type Exp: NumberInstance
[src]
type Class: NumberClass<Instance = Self>
[src]
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.
Provided methods
fn and(self, other: Self) -> Self where
Boolean: CastFrom<Self>,
[src]
Boolean: CastFrom<Self>,
Return true
if self
and other
are nonzero.
fn not(self) -> Self where
Boolean: CastFrom<Self>,
[src]
Boolean: CastFrom<Self>,
Return true
if this number is zero.
fn or(self, other: Self) -> Self where
Boolean: CastFrom<Self>,
[src]
Boolean: CastFrom<Self>,
Return true
if self
or other
is nonzero.
fn xor(self, other: Self) -> Self where
Boolean: CastFrom<Self>,
[src]
Boolean: CastFrom<Self>,
Return true
if exactly one of self
and other
is zero.
Implementors
impl NumberInstance for Complex
[src]
impl NumberInstance for Complex
[src]impl NumberInstance for Float
[src]
impl NumberInstance for Float
[src]impl NumberInstance for Int
[src]
impl NumberInstance for Int
[src]impl NumberInstance for Number
[src]
impl NumberInstance for Number
[src]impl NumberInstance for UInt
[src]
impl NumberInstance for UInt
[src]impl NumberInstance for Boolean
[src]
impl NumberInstance for Boolean
[src]