Trait arithmetic_eval::arith::OrdArithmetic

source ·
pub trait OrdArithmetic<T>: Arithmetic<T> {
    // Required method
    fn partial_cmp(&self, x: &T, y: &T) -> Option<Ordering>;
}
Expand description

Extends an Arithmetic with a comparison operation on values.

Required Methods§

source

fn partial_cmp(&self, x: &T, y: &T) -> Option<Ordering>

Compares two values. Returns None if the numbers are not comparable, or the comparison result otherwise.

Trait Implementations§

source§

impl<T> Arithmetic<T> for Box<dyn OrdArithmetic<T>>

source§

fn add(&self, x: T, y: T) -> Result<T, ArithmeticError>

Adds two values. Read more
source§

fn sub(&self, x: T, y: T) -> Result<T, ArithmeticError>

Subtracts two values. Read more
source§

fn mul(&self, x: T, y: T) -> Result<T, ArithmeticError>

Multiplies two values. Read more
source§

fn div(&self, x: T, y: T) -> Result<T, ArithmeticError>

Divides two values. Read more
source§

fn pow(&self, x: T, y: T) -> Result<T, ArithmeticError>

Raises x to the power of y. Read more
source§

fn neg(&self, x: T) -> Result<T, ArithmeticError>

Negates a value. Read more
source§

fn eq(&self, x: &T, y: &T) -> bool

Checks if two values are equal. Note that equality can be a non-trivial operation; e.g., different numbers may be equal as per modular arithmetic.
source§

impl<T> Debug for dyn OrdArithmetic<T> + '_

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> OrdArithmetic<T> for Box<dyn OrdArithmetic<T>>

source§

fn partial_cmp(&self, x: &T, y: &T) -> Option<Ordering>

Compares two values. Returns None if the numbers are not comparable, or the comparison result otherwise.

Implementations on Foreign Types§

source§

impl<T> OrdArithmetic<T> for Box<dyn OrdArithmetic<T>>

source§

fn partial_cmp(&self, x: &T, y: &T) -> Option<Ordering>

Implementors§

source§

impl<T> OrdArithmetic<T> for StdArithmetic
where Self: Arithmetic<T>, T: PartialOrd,

source§

impl<T> OrdArithmetic<T> for WrappingArithmetic
where Self: Arithmetic<T>, T: PartialOrd,

source§

impl<T, A> OrdArithmetic<T> for FullArithmetic<T, A>
where A: Arithmetic<T>,

source§

impl<T, Kind> OrdArithmetic<T> for CheckedArithmetic<Kind>
where Self: Arithmetic<T>, T: PartialOrd,