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§

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.

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§

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§

§

impl RelativeEq for f32

§

fn default_max_relative() -> f32

§

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

§

impl RelativeEq for f64

§

fn default_max_relative() -> f64

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

Implementors§

source§

impl<T> RelativeEq for pixel_game_lib::mat::repr_c::row_major::Mat2<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::mat::repr_c::row_major::Mat3<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::mat::repr_c::row_major::Mat4<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::mat::repr_simd::column_major::Mat2<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::mat::repr_simd::column_major::Mat3<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::mat::repr_simd::column_major::Mat4<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::mat::repr_simd::row_major::Mat2<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::mat::repr_simd::row_major::Mat3<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::mat::repr_simd::row_major::Mat4<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::quaternion::repr_simd::Quaternion<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::Extent2<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::Extent3<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::Mat2<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::Mat3<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::Mat4<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::Quaternion<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::Rgb<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::Rgba<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::Vec2<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::Vec3<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::Vec4<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::vec::repr_simd::Extent2<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::vec::repr_simd::Extent3<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::vec::repr_simd::Rgb<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::vec::repr_simd::Rgba<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::vec::repr_simd::Vec2<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::vec::repr_simd::Vec3<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,

source§

impl<T> RelativeEq for pixel_game_lib::vec::repr_simd::Vec4<T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Copy,