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

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl AbsDiffEq for f32

§

type Epsilon = f32

source§

fn default_epsilon() -> f32

source§

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

source§

impl AbsDiffEq for f64

§

type Epsilon = f64

source§

fn default_epsilon() -> f64

source§

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

source§

impl AbsDiffEq for i8

§

type Epsilon = i8

source§

fn default_epsilon() -> i8

source§

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

source§

impl AbsDiffEq for i16

§

type Epsilon = i16

source§

fn default_epsilon() -> i16

source§

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

source§

impl AbsDiffEq for i32

§

type Epsilon = i32

source§

fn default_epsilon() -> i32

source§

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

source§

impl AbsDiffEq for i64

§

type Epsilon = i64

source§

fn default_epsilon() -> i64

source§

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

source§

impl AbsDiffEq for isize

§

type Epsilon = isize

source§

fn default_epsilon() -> isize

source§

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

source§

impl AbsDiffEq for u8

§

type Epsilon = u8

source§

fn default_epsilon() -> u8

source§

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

source§

impl AbsDiffEq for u16

§

type Epsilon = u16

source§

fn default_epsilon() -> u16

source§

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

source§

impl AbsDiffEq for u32

§

type Epsilon = u32

source§

fn default_epsilon() -> u32

source§

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

source§

impl AbsDiffEq for u64

§

type Epsilon = u64

source§

fn default_epsilon() -> u64

source§

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

source§

impl AbsDiffEq for usize

§

type Epsilon = usize

source§

fn default_epsilon() -> usize

source§

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

source§

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

§

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

§

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,

§

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>

§

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>

§

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§