Skip to main content

OrderedField

Trait OrderedField 

Source
pub trait OrderedField:
    Clone
    + PartialEq
    + Eq
    + Hash
    + Debug {
    // Required methods
    fn zero() -> Self;
    fn one() -> Self;
    fn from_i64(n: i64) -> Self;
    fn is_zero(&self) -> bool;
    fn add(&self, o: &Self) -> Self;
    fn neg(&self) -> Self;
    fn mul(&self, o: &Self) -> Self;
    fn recip(&self) -> Option<Self>;
    fn signum(&self) -> i32;

    // Provided method
    fn sub(&self, o: &Self) -> Self { ... }
}
Expand description

A field with exact arithmetic and a decided order, read from the sign of an element.

Required Methods§

Source

fn zero() -> Self

Source

fn one() -> Self

Source

fn from_i64(n: i64) -> Self

Source

fn is_zero(&self) -> bool

Source

fn add(&self, o: &Self) -> Self

Source

fn neg(&self) -> Self

Source

fn mul(&self, o: &Self) -> Self

Source

fn recip(&self) -> Option<Self>

None for zero.

Source

fn signum(&self) -> i32

−1, 0 or 1.

Provided Methods§

Source

fn sub(&self, o: &Self) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§