pub struct Matcher<'a, In, PosOut, NegOut = PosOut> { /* private fields */ }
Expand description
A matcher.
This type is a matcher that can be used to make assertions. You can create a matcher from any
type which implements Match
or TransformMatch
.
Implementations§
Source§impl<'a, Actual> Matcher<'a, Actual, Actual>
impl<'a, Actual> Matcher<'a, Actual, Actual>
Source§impl<'a, In, PosOut, NegOut> Matcher<'a, In, PosOut, NegOut>
impl<'a, In, PosOut, NegOut> Matcher<'a, In, PosOut, NegOut>
Sourcepub fn transform<M, Fmt>(matcher: M, format: Fmt) -> Selfwhere
M: TransformMatch<In = In, PosOut = PosOut, NegOut = NegOut> + 'a,
Fmt: MatcherFormat<Pos = M::PosFail, Neg = M::NegFail> + 'a,
pub fn transform<M, Fmt>(matcher: M, format: Fmt) -> Selfwhere
M: TransformMatch<In = In, PosOut = PosOut, NegOut = NegOut> + 'a,
Fmt: MatcherFormat<Pos = M::PosFail, Neg = M::NegFail> + 'a,
Create a new Matcher
from a type that implements TransformMatch
and a formatter.
Sourcepub fn transform_neg<M, Fmt>(matcher: M, format: Fmt) -> Selfwhere
M: TransformMatch<In = In, PosOut = NegOut, NegOut = PosOut> + 'a,
Fmt: MatcherFormat<Pos = M::NegFail, Neg = M::PosFail> + 'a,
pub fn transform_neg<M, Fmt>(matcher: M, format: Fmt) -> Selfwhere
M: TransformMatch<In = In, PosOut = NegOut, NegOut = PosOut> + 'a,
Fmt: MatcherFormat<Pos = M::NegFail, Neg = M::PosFail> + 'a,
Sourcepub fn wrapped<Fmt>(self, format: Fmt) -> Selfwhere
In: 'a,
PosOut: 'a,
NegOut: 'a,
Fmt: MatcherFormat<Pos = FormattedFailure, Neg = FormattedFailure> + 'a,
pub fn wrapped<Fmt>(self, format: Fmt) -> Selfwhere
In: 'a,
PosOut: 'a,
NegOut: 'a,
Fmt: MatcherFormat<Pos = FormattedFailure, Neg = FormattedFailure> + 'a,
Wrap this matcher with a new formatter.
Sourcepub fn into_box(self) -> BoxTransformMatch<'a, In, PosOut, NegOut>
pub fn into_box(self) -> BoxTransformMatch<'a, In, PosOut, NegOut>
Convert this matcher into a BoxTransformMatch
.
Trait Implementations§
Source§impl<'a, In, PosOut, NegOut> DynTransformMatch for Matcher<'a, In, PosOut, NegOut>
impl<'a, In, PosOut, NegOut> DynTransformMatch for Matcher<'a, In, PosOut, NegOut>
Source§type In = In
type In = In
Same as
TransformMatch::In
.Source§type PosOut = PosOut
type PosOut = PosOut
Same as
TransformMatch::PosOut
.Source§type NegOut = NegOut
type NegOut = NegOut
Same as
TransformMatch::NegOut
.Source§fn match_pos(
self: Box<Self>,
actual: Self::In,
) -> Result<MatchOutcome<Self::PosOut, FormattedFailure>>
fn match_pos( self: Box<Self>, actual: Self::In, ) -> Result<MatchOutcome<Self::PosOut, FormattedFailure>>
An object-safe version of
TransformMatch::match_pos
.Source§fn match_neg(
self: Box<Self>,
actual: Self::In,
) -> Result<MatchOutcome<Self::NegOut, FormattedFailure>>
fn match_neg( self: Box<Self>, actual: Self::In, ) -> Result<MatchOutcome<Self::NegOut, FormattedFailure>>
An object-safe version of
TransformMatch::match_neg
.Auto Trait Implementations§
impl<'a, In, PosOut, NegOut> Freeze for Matcher<'a, In, PosOut, NegOut>
impl<'a, In, PosOut, NegOut = PosOut> !RefUnwindSafe for Matcher<'a, In, PosOut, NegOut>
impl<'a, In, PosOut, NegOut = PosOut> !Send for Matcher<'a, In, PosOut, NegOut>
impl<'a, In, PosOut, NegOut = PosOut> !Sync for Matcher<'a, In, PosOut, NegOut>
impl<'a, In, PosOut, NegOut> Unpin for Matcher<'a, In, PosOut, NegOut>
impl<'a, In, PosOut, NegOut = PosOut> !UnwindSafe for Matcher<'a, In, PosOut, NegOut>
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