approx

Trait 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.

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.

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 + ?Sized> RelativeEq for &'a T

Source§

fn default_max_relative() -> T::Epsilon

Source§

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

Source§

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

Source§

fn default_max_relative() -> T::Epsilon

Source§

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

Source§

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

Source§

fn default_max_relative() -> A::Epsilon

Source§

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

Source§

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

Source§

fn default_max_relative() -> T::Epsilon

Source§

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

Source§

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

Source§

fn default_max_relative() -> T::Epsilon

Source§

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

Implementors§