pub struct MatchResultBuilder { /* private fields */ }
Expand description
A builder for creating MatchResult
s.
Create a new builder with new()
or for_()
and finalize it either with matched()
, failed_because()
, or failed_comparison()
.
Implementations§
Source§impl MatchResultBuilder
impl MatchResultBuilder
Sourcepub fn new() -> MatchResultBuilder
pub fn new() -> MatchResultBuilder
Creates a MatchResultBuilder
for an anonymous Matcher
.
Sourcepub fn for_(name: &str) -> MatchResultBuilder
pub fn for_(name: &str) -> MatchResultBuilder
Creates MatchResultBuilder
for a Matcher
with the given name
Sourcepub fn matched(self) -> MatchResult
pub fn matched(self) -> MatchResult
Finalzes the builder indicating that the Matcher
matched the inspected value.
Sourcepub fn failed_because(self, reason: &str) -> MatchResult
pub fn failed_because(self, reason: &str) -> MatchResult
Finalzes the builder indicating that the Matcher
failed to the inspected value.
The reason
should give a short indication why the matcher failed.
Sourcepub fn failed_comparison<T: Debug>(
self,
actual: &T,
expected: &T,
) -> MatchResult
pub fn failed_comparison<T: Debug>( self, actual: &T, expected: &T, ) -> MatchResult
Finalzes the builder indicating that the Matcher
failed to the inspected value.
The actual
and expected
value are used the generate a useful error message.
Auto Trait Implementations§
impl Freeze for MatchResultBuilder
impl RefUnwindSafe for MatchResultBuilder
impl Send for MatchResultBuilder
impl Sync for MatchResultBuilder
impl Unpin for MatchResultBuilder
impl UnwindSafe for MatchResultBuilder
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