pub struct NearMatcher<T: Debug> { /* private fields */ }Available on crate feature
num-traits only.Expand description
A matcher which matches floating-point numbers approximately equal to its expected value.
Implementations§
Source§impl<T: Debug> NearMatcher<T>
impl<T: Debug> NearMatcher<T>
Sourcepub fn nans_are_equal(self) -> Self
pub fn nans_are_equal(self) -> Self
Configures this instance to treat two NaNs as equal.
This behaviour differs from the IEEE standad for floating point which treats two NaNs as infinitely far apart.
Sourcepub fn nans_are_not_equal(self) -> Self
pub fn nans_are_not_equal(self) -> Self
Configures this instance to treat two NaNs as not equal.
This behaviour complies with the IEEE standad for floating point. It is the default behaviour for this matcher, so invoking this method is usually redunant.
Trait Implementations§
Source§impl<T: Debug> Describable for NearMatcher<T>
impl<T: Debug> Describable for NearMatcher<T>
Source§fn describe(&self, matcher_result: MatcherResult) -> Description
fn describe(&self, matcher_result: MatcherResult) -> Description
Returns a description of
self or a negative description if
matcher_result is DoesNotMatch. Read moreSource§impl<T: Debug + Float> Matcher<T> for NearMatcher<T>
impl<T: Debug + Float> Matcher<T> for NearMatcher<T>
Source§fn matches(&self, actual: &T) -> MatcherResult
fn matches(&self, actual: &T) -> MatcherResult
Returns whether the condition matches the datum
actual. Read moreSource§fn explain_match(&self, actual: &ActualT) -> Description
fn explain_match(&self, actual: &ActualT) -> Description
Auto Trait Implementations§
impl<T> Freeze for NearMatcher<T>where
T: Freeze,
impl<T> RefUnwindSafe for NearMatcher<T>where
T: RefUnwindSafe,
impl<T> Send for NearMatcher<T>where
T: Send,
impl<T> Sync for NearMatcher<T>where
T: Sync,
impl<T> Unpin for NearMatcher<T>where
T: Unpin,
impl<T> UnsafeUnpin for NearMatcher<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for NearMatcher<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more