Skip to main content

Field

Trait Field 

Source
pub trait Field:
    Eq
    + PartialOrd
    + Zero
    + Neg<Output = Self>
    + One
    + Add<Self, Output = Self>
    + for<'r> Add<&'r Self, Output = Self>
    + AddAssign<Self>
    + for<'r> AddAssign<&'r Self>
    + Sum
    + Sub<Self, Output = Self>
    + for<'r> Sub<&'r Self, Output = Self>
    + SubAssign<Self>
    + for<'r> SubAssign<&'r Self>
    + Mul<Self, Output = Self>
    + for<'r> Mul<&'r Self, Output = Self>
    + MulAssign<Self>
    + for<'r> MulAssign<&'r Self>
    + Div<Self, Output = Self>
    + for<'r> Div<&'r Self, Output = Self>
    + DivAssign<Self>
    + for<'r> DivAssign<&'r Self>
    + Clone
    + Display
    + Debug { }
Expand description

Basic field operations with Self and with references to Self.

This trait is deliberately not blanket-implemented over its bounds. The primitive integers satisfy every one of them, but i32 is not a field: its division truncates. Because this crate exists to give the simplex method exact arithmetic, a type that silently rounds must not be usable where a field is required. Implement it explicitly for types whose four operations are exact.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§