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

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§