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>
sourcepub fn new<M, Fmt>(matcher: M, format: Fmt) -> Selfwhere
M: Match<Actual> + 'a,
Fmt: MatcherFormat<Pos = M::Fail, Neg = M::Fail> + 'a,
Actual: 'a,
pub fn new<M, Fmt>(matcher: M, format: Fmt) -> Selfwhere M: Match<Actual> + 'a, Fmt: MatcherFormat<Pos = M::Fail, Neg = M::Fail> + 'a, Actual: 'a,
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>
§type In = In
type In = In
Same as
TransformMatch::In
.§type PosOut = PosOut
type PosOut = PosOut
Same as
TransformMatch::PosOut
.§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 = 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