Trait sprs::approx::RelativeEq

source ·
pub trait RelativeEq<Rhs = Self>: AbsDiffEq<Rhs>
where Rhs: ?Sized,
{ // Required methods fn default_max_relative() -> Self::Epsilon; fn relative_eq( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool; // Provided method fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool { ... } }
Expand description

Equality comparisons between two numbers using both the absolute difference and relative based comparisons.

Required Methods§

source

fn default_max_relative() -> Self::Epsilon

The default relative tolerance for testing values that are far-apart.

This is used when no max_relative value is supplied to the [relative_eq] macro.

source

fn relative_eq( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

A test for equality that uses a relative comparison if the values are far apart.

Provided Methods§

source

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

The inverse of RelativeEq::relative_eq.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl RelativeEq for f32

source§

fn default_max_relative() -> f32

source§

fn relative_eq(&self, other: &f32, epsilon: f32, max_relative: f32) -> bool

source§

impl RelativeEq for f64

source§

fn default_max_relative() -> f64

source§

fn relative_eq(&self, other: &f64, epsilon: f64, max_relative: f64) -> bool

source§

impl<'a, T> RelativeEq for &'a T
where T: RelativeEq + ?Sized,

source§

fn default_max_relative() -> <T as AbsDiffEq>::Epsilon

source§

fn relative_eq( &self, other: &&'a T, epsilon: <T as AbsDiffEq>::Epsilon, max_relative: <T as AbsDiffEq>::Epsilon, ) -> bool

source§

impl<'a, T> RelativeEq for &'a mut T
where T: RelativeEq + ?Sized,

source§

fn default_max_relative() -> <T as AbsDiffEq>::Epsilon

source§

fn relative_eq( &self, other: &&'a mut T, epsilon: <T as AbsDiffEq>::Epsilon, max_relative: <T as AbsDiffEq>::Epsilon, ) -> bool

source§

impl<A, B> RelativeEq<[B]> for [A]
where A: RelativeEq<B>, <A as AbsDiffEq<B>>::Epsilon: Clone,

source§

fn default_max_relative() -> <A as AbsDiffEq<B>>::Epsilon

source§

fn relative_eq( &self, other: &[B], epsilon: <A as AbsDiffEq<B>>::Epsilon, max_relative: <A as AbsDiffEq<B>>::Epsilon, ) -> bool

source§

impl<T> RelativeEq for Cell<T>
where T: RelativeEq + Copy,

source§

fn default_max_relative() -> <T as AbsDiffEq>::Epsilon

source§

fn relative_eq( &self, other: &Cell<T>, epsilon: <T as AbsDiffEq>::Epsilon, max_relative: <T as AbsDiffEq>::Epsilon, ) -> bool

source§

impl<T> RelativeEq for RefCell<T>
where T: RelativeEq + ?Sized,

source§

fn default_max_relative() -> <T as AbsDiffEq>::Epsilon

source§

fn relative_eq( &self, other: &RefCell<T>, epsilon: <T as AbsDiffEq>::Epsilon, max_relative: <T as AbsDiffEq>::Epsilon, ) -> bool

Implementors§

source§

impl<N, I, IS1, DS1, IS2, DS2> RelativeEq<CsVecBase<IS2, DS2, N, I>> for CsVecBase<IS1, DS1, N, I>
where I: SpIndex, CsVecBase<IS1, DS1, N, I>: PartialEq<CsVecBase<IS2, DS2, N, I>>, IS1: Deref<Target = [I]>, IS2: Deref<Target = [I]>, DS1: Deref<Target = [N]>, DS2: Deref<Target = [N]>, N: RelativeEq + Zero, N::Epsilon: Clone,

source§

impl<N, I, Iptr, IS1, DS1, ISptr1, IS2, ISptr2, DS2> RelativeEq<CsMatBase<N, I, ISptr2, IS2, DS2, Iptr>> for CsMatBase<N, I, ISptr1, IS1, DS1, Iptr>
where I: SpIndex, Iptr: SpIndex, CsMatBase<N, I, ISptr1, IS1, DS1, Iptr>: PartialEq<CsMatBase<N, I, ISptr2, IS2, DS2, Iptr>>, IS1: Deref<Target = [I]>, IS2: Deref<Target = [I]>, ISptr1: Deref<Target = [Iptr]>, ISptr2: Deref<Target = [Iptr]>, DS1: Deref<Target = [N]>, DS2: Deref<Target = [N]>, N: RelativeEq + Zero, N::Epsilon: Clone,