Trait number_general::NumberClass [−][src]
pub trait NumberClass: Default + Into<NumberType> + Ord + Send + Display {
type Instance: NumberInstance;
fn cast(&self, n: Number) -> Self::Instance;
fn size(self) -> usize;
fn one(&self) -> <Self as NumberClass>::Instance;
fn zero(&self) -> <Self as NumberClass>::Instance;
fn is_complex(&self) -> bool { ... }
fn is_real(&self) -> bool { ... }
}
Expand description
Defines common properties of numeric types supported by Number
.
Associated Types
type Instance: NumberInstance
Required methods
Cast the given Number
into an instance of this type.
fn one(&self) -> <Self as NumberClass>::Instance
fn one(&self) -> <Self as NumberClass>::Instance
Return 1
as an instance of this type.
fn zero(&self) -> <Self as NumberClass>::Instance
fn zero(&self) -> <Self as NumberClass>::Instance
Return 0
as an instance of this type.
Provided methods
fn is_complex(&self) -> bool
fn is_complex(&self) -> bool
Return true
if this is a complex type.