pub trait NumberClass: Default + Into<NumberType> + Ord + Send + Display {
    type Instance: NumberInstance;

    // Required methods
    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;

    // Provided methods
    fn is_complex(&self) -> bool { ... }
    fn is_real(&self) -> bool { ... }
}
Expand description

Defines common properties of numeric types supported by Number.

Required Associated Types§

Required Methods§

source

fn cast(&self, n: Number) -> Self::Instance

Cast the given Number into an instance of this type.

source

fn size(self) -> usize

Return the maximum size of this type of Number, in bits.

source

fn one(&self) -> <Self as NumberClass>::Instance

Return 1 as an instance of this type.

source

fn zero(&self) -> <Self as NumberClass>::Instance

Return 0 as an instance of this type.

Provided Methods§

source

fn is_complex(&self) -> bool

Return true if this is a complex type.

source

fn is_real(&self) -> bool

Return false if this is a complex type.

Object Safety§

This trait is not object safe.

Implementors§