Module matcher
Expand description
matcher utilities for any middleware where need to match
on incoming requests within a given Context
This module provides the Matcher
trait and convenience utilities around it.
- Examples of this are iterator “reducers” as made available via
IteratorMatcherExt
, as well as optionalMatcher::or
andMatcher::and
trait methods. - These all serve as building blocks together with
And
,Or
,Not
and a bool to combine and transform any kind ofMatcher
. - And finally there is
MatchFn
, easily created usingmatch_fn
to create aMatcher
from any compatibleFn
.
Structs§
- And
- A matcher that matches if all of the inner matchers match.
- Extension
Matcher - A matcher which allows you to match based on an extension,
either by comparing with an extension (
ExtensionMatcher::with_const
), or using a custom predicate (ExtensionMatcher::with_fn
). - Matcher
Router - Wrapper type that can be used to turn a tuple of (
Matcher
,Service
) tuples into a singleService
. - Not
- A matcher that matches if the inner matcher does not match.
- Or
- A matcher that matches if any of the inner matchers match.
Traits§
- Iterator
Matcher Ext - Extension to apply matcher operations to an
Iterator
ofMatcher
s. - MatchFn
- A
MatchFn
is aMatcher
implemented using a function. - Matcher
- A condition to decide whether
Request
within the givenContext
matches for router or other middleware purposes.