approx

Trait AbsDiffEq

Source
pub trait AbsDiffEq<Rhs = Self>: PartialEq<Rhs>
where Rhs: ?Sized,
{ type Epsilon; // Required methods fn default_epsilon() -> Self::Epsilon; fn abs_diff_eq(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool; // Provided method fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool { ... } }
Expand description

Equality that is defined using the absolute difference of two numbers.

Required Associated Types§

Source

type Epsilon

Used for specifying relative comparisons.

Required Methods§

Source

fn default_epsilon() -> Self::Epsilon

The default tolerance to use when testing values that are close together.

This is used when no epsilon value is supplied to the [abs_diff_eq!], [relative_eq!], or [ulps_eq!] macros.

Source

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

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.

Provided Methods§

Source

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

The inverse of AbsDiffEq::abs_diff_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 AbsDiffEq for f32

Source§

type Epsilon = f32

Source§

fn default_epsilon() -> f32

Source§

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

Source§

impl AbsDiffEq for f64

Source§

type Epsilon = f64

Source§

fn default_epsilon() -> f64

Source§

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

Source§

impl AbsDiffEq for i8

Source§

type Epsilon = i8

Source§

fn default_epsilon() -> i8

Source§

fn abs_diff_eq(&self, other: &i8, epsilon: i8) -> bool

Source§

impl AbsDiffEq for i16

Source§

type Epsilon = i16

Source§

fn default_epsilon() -> i16

Source§

fn abs_diff_eq(&self, other: &i16, epsilon: i16) -> bool

Source§

impl AbsDiffEq for i32

Source§

type Epsilon = i32

Source§

fn default_epsilon() -> i32

Source§

fn abs_diff_eq(&self, other: &i32, epsilon: i32) -> bool

Source§

impl AbsDiffEq for i64

Source§

type Epsilon = i64

Source§

fn default_epsilon() -> i64

Source§

fn abs_diff_eq(&self, other: &i64, epsilon: i64) -> bool

Source§

impl AbsDiffEq for isize

Source§

impl AbsDiffEq for u8

Source§

type Epsilon = u8

Source§

fn default_epsilon() -> u8

Source§

fn abs_diff_eq(&self, other: &u8, epsilon: u8) -> bool

Source§

impl AbsDiffEq for u16

Source§

type Epsilon = u16

Source§

fn default_epsilon() -> u16

Source§

fn abs_diff_eq(&self, other: &u16, epsilon: u16) -> bool

Source§

impl AbsDiffEq for u32

Source§

type Epsilon = u32

Source§

fn default_epsilon() -> u32

Source§

fn abs_diff_eq(&self, other: &u32, epsilon: u32) -> bool

Source§

impl AbsDiffEq for u64

Source§

type Epsilon = u64

Source§

fn default_epsilon() -> u64

Source§

fn abs_diff_eq(&self, other: &u64, epsilon: u64) -> bool

Source§

impl AbsDiffEq for usize

Source§

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

Source§

type Epsilon = <T as AbsDiffEq>::Epsilon

Source§

fn default_epsilon() -> T::Epsilon

Source§

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

Source§

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

Source§

type Epsilon = <T as AbsDiffEq>::Epsilon

Source§

fn default_epsilon() -> T::Epsilon

Source§

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

Source§

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

Source§

type Epsilon = <A as AbsDiffEq<B>>::Epsilon

Source§

fn default_epsilon() -> A::Epsilon

Source§

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

Source§

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

Source§

type Epsilon = <T as AbsDiffEq>::Epsilon

Source§

fn default_epsilon() -> T::Epsilon

Source§

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

Source§

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

Source§

type Epsilon = <T as AbsDiffEq>::Epsilon

Source§

fn default_epsilon() -> T::Epsilon

Source§

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

Implementors§