pub struct MatchResult {
pub matched: bool,
pub failure: Option<Mismatch>,
}Expand description
The structured outcome of Matcher::check.
§Invariant
matched and failure always disagree: matched == failure.is_none().
Construct values through MatchResult::pass and MatchResult::fail
rather than building the struct literal, so the invariant cannot be broken.
Fields§
§matched: boolWhether the value met the expectation.
failure: Option<Mismatch>The mismatch detail, present exactly when matched is false.
Implementations§
Source§impl MatchResult
impl MatchResult
Sourcepub fn pass() -> MatchResult
pub fn pass() -> MatchResult
The value met the expectation.
Sourcepub fn fail(mismatch: Mismatch) -> MatchResult
pub fn fail(mismatch: Mismatch) -> MatchResult
The value did not meet the expectation; mismatch explains why.
Trait Implementations§
Source§impl Clone for MatchResult
impl Clone for MatchResult
Source§fn clone(&self) -> MatchResult
fn clone(&self) -> MatchResult
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MatchResult
impl RefUnwindSafe for MatchResult
impl Send for MatchResult
impl Sync for MatchResult
impl Unpin for MatchResult
impl UnsafeUnpin for MatchResult
impl UnwindSafe for MatchResult
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