pub struct Mismatch<Expected, Actual> {
pub expected: Expected,
pub actual: Actual,
}
Expand description
A value that is returned by matchers when the expected and actual values differ.
This is meant to be a deliberately generic value that can be reused in a number of different
matchers and formatted with MismatchFormat
.
This can be used for matchers like equal
to represent two values being not equal, but it can
also be used for matchers like be_lt
or be_ge
to represent different kinds of
relationships.
Use this over Expectation
when you want to record the “expected” value alongside the actual
value.
When returned by a matcher, this value just means, “here is the expected value and here is the actual value.” It’s up to the formatter to determine how that information is presented to the user.
Fields§
§expected: Expected
The expected value.
actual: Actual
The actual value.
Trait Implementations§
source§impl<Expected: PartialEq, Actual: PartialEq> PartialEq<Mismatch<Expected, Actual>> for Mismatch<Expected, Actual>
impl<Expected: PartialEq, Actual: PartialEq> PartialEq<Mismatch<Expected, Actual>> for Mismatch<Expected, Actual>
impl<Expected: Eq, Actual: Eq> Eq for Mismatch<Expected, Actual>
impl<Expected, Actual> StructuralEq for Mismatch<Expected, Actual>
impl<Expected, Actual> StructuralPartialEq for Mismatch<Expected, Actual>
Auto Trait Implementations§
impl<Expected, Actual> RefUnwindSafe for Mismatch<Expected, Actual>where Actual: RefUnwindSafe, Expected: RefUnwindSafe,
impl<Expected, Actual> Send for Mismatch<Expected, Actual>where Actual: Send, Expected: Send,
impl<Expected, Actual> Sync for Mismatch<Expected, Actual>where Actual: Sync, Expected: Sync,
impl<Expected, Actual> Unpin for Mismatch<Expected, Actual>where Actual: Unpin, Expected: Unpin,
impl<Expected, Actual> UnwindSafe for Mismatch<Expected, Actual>where Actual: UnwindSafe, Expected: 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