pub enum HttpMatcherKind<State, Body> {
All(Vec<HttpMatcher<State, Body>>),
Method(MethodMatcher),
Path(PathMatcher),
Domain(DomainMatcher),
Version(VersionMatcher),
Any(Vec<HttpMatcher<State, Body>>),
Uri(UriMatcher),
Header(HeaderMatcher),
Socket(SocketMatcher<State, Request<Body>>),
Custom(Arc<dyn Matcher<State, Request<Body>>>),
}
Expand description
A matcher that is used to match an http Request
Variants§
All(Vec<HttpMatcher<State, Body>>)
zero or more HttpMatcher
s that all need to match in order for the matcher to return true
.
Method(MethodMatcher)
MethodMatcher
, a matcher that matches one or more HTTP methods.
Path(PathMatcher)
PathMatcher
, a matcher based on the URI path.
Domain(DomainMatcher)
DomainMatcher
, a matcher based on the (sub)domain of the request’s URI.
Version(VersionMatcher)
VersionMatcher
, a matcher based on the HTTP version of the request.
Any(Vec<HttpMatcher<State, Body>>)
zero or more HttpMatcher
s that at least one needs to match in order for the matcher to return true
.
Uri(UriMatcher)
UriMatcher
, a matcher the request’s URI, using a substring or regex pattern.
Header(HeaderMatcher)
HeaderMatcher
, a matcher based on the Request
’s headers.
Socket(SocketMatcher<State, Request<Body>>)
SocketMatcher
, a matcher that matches on the SocketAddr
of the peer.
Custom(Arc<dyn Matcher<State, Request<Body>>>)
A custom matcher that implements rama_core::matcher::Matcher
.
Trait Implementations§
Source§impl<State, Body> Clone for HttpMatcherKind<State, Body>
impl<State, Body> Clone for HttpMatcherKind<State, Body>
Source§impl<State, Body> Debug for HttpMatcherKind<State, Body>
impl<State, Body> Debug for HttpMatcherKind<State, Body>
Source§impl<State, Body> Matcher<State, Request<Body>> for HttpMatcherKind<State, Body>
impl<State, Body> Matcher<State, Request<Body>> for HttpMatcherKind<State, Body>
Source§fn matches(
&self,
ext: Option<&mut Extensions>,
ctx: &Context<State>,
req: &Request<Body>,
) -> bool
fn matches( &self, ext: Option<&mut Extensions>, ctx: &Context<State>, req: &Request<Body>, ) -> bool
returns true on a match, false otherwise Read more
Source§fn or<M>(self, other: M) -> impl Matcher<State, Request>
fn or<M>(self, other: M) -> impl Matcher<State, Request>
Provide an alternative matcher to match if the current one does not match.
Auto Trait Implementations§
impl<State, Body> !Freeze for HttpMatcherKind<State, Body>
impl<State, Body> !RefUnwindSafe for HttpMatcherKind<State, Body>
impl<State, Body> Send for HttpMatcherKind<State, Body>
impl<State, Body> Sync for HttpMatcherKind<State, Body>
impl<State, Body> Unpin for HttpMatcherKind<State, Body>
impl<State, Body> !UnwindSafe for HttpMatcherKind<State, Body>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more