pub struct HttpMatcher<State, Body> { /* private fields */ }
Expand description
A matcher that is used to match an http Request
Implementations§
Source§impl<State, Body> HttpMatcher<State, Body>
impl<State, Body> HttpMatcher<State, Body>
Sourcepub fn method(method: MethodMatcher) -> Self
pub fn method(method: MethodMatcher) -> Self
Create a new matcher that matches one or more HTTP methods.
See MethodMatcher
for more information.
Sourcepub fn and_method(self, method: MethodMatcher) -> Self
pub fn and_method(self, method: MethodMatcher) -> Self
Create a matcher that also matches one or more HTTP methods on top of the existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn or_method(self, method: MethodMatcher) -> Self
pub fn or_method(self, method: MethodMatcher) -> Self
Create a matcher that can also match one or more HTTP methods as an alternative to the existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn method_delete() -> Self
pub fn method_delete() -> Self
Create a new matcher that matches MethodMatcher::DELETE
requests.
See MethodMatcher
for more information.
Sourcepub fn and_method_delete(self) -> Self
pub fn and_method_delete(self) -> Self
Add a new matcher that also matches MethodMatcher::DELETE
on top of the existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn or_method_delete(self) -> Self
pub fn or_method_delete(self) -> Self
Add a new matcher that can also match MethodMatcher::DELETE
as an alternative tothe existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn method_get() -> Self
pub fn method_get() -> Self
Create a new matcher that matches MethodMatcher::GET
requests.
See MethodMatcher
for more information.
Sourcepub fn and_method_get(self) -> Self
pub fn and_method_get(self) -> Self
Add a new matcher that also matches MethodMatcher::GET
on top of the existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn or_method_get(self) -> Self
pub fn or_method_get(self) -> Self
Add a new matcher that can also match MethodMatcher::GET
as an alternative tothe existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn method_head() -> Self
pub fn method_head() -> Self
Create a new matcher that matches MethodMatcher::HEAD
requests.
See MethodMatcher
for more information.
Sourcepub fn and_method_head(self) -> Self
pub fn and_method_head(self) -> Self
Add a new matcher that also matches MethodMatcher::HEAD
on top of the existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn or_method_head(self) -> Self
pub fn or_method_head(self) -> Self
Add a new matcher that can also match MethodMatcher::HEAD
as an alternative tothe existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn method_options() -> Self
pub fn method_options() -> Self
Create a new matcher that matches MethodMatcher::OPTIONS
requests.
See MethodMatcher
for more information.
Sourcepub fn and_method_options(self) -> Self
pub fn and_method_options(self) -> Self
Add a new matcher that also matches MethodMatcher::OPTIONS
on top of the existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn or_method_options(self) -> Self
pub fn or_method_options(self) -> Self
Add a new matcher that can also match MethodMatcher::OPTIONS
as an alternative tothe existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn method_patch() -> Self
pub fn method_patch() -> Self
Create a new matcher that matches MethodMatcher::PATCH
requests.
See MethodMatcher
for more information.
Sourcepub fn and_method_patch(self) -> Self
pub fn and_method_patch(self) -> Self
Add a new matcher that also matches MethodMatcher::PATCH
on top of the existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn or_method_patch(self) -> Self
pub fn or_method_patch(self) -> Self
Add a new matcher that can also match MethodMatcher::PATCH
as an alternative tothe existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn method_post() -> Self
pub fn method_post() -> Self
Create a new matcher that matches MethodMatcher::POST
requests.
See MethodMatcher
for more information.
Sourcepub fn and_method_post(self) -> Self
pub fn and_method_post(self) -> Self
Add a new matcher that also matches MethodMatcher::POST
on top of the existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn or_method_post(self) -> Self
pub fn or_method_post(self) -> Self
Add a new matcher that can also match MethodMatcher::POST
as an alternative tothe existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn method_put() -> Self
pub fn method_put() -> Self
Create a new matcher that matches MethodMatcher::PUT
requests.
See MethodMatcher
for more information.
Sourcepub fn and_method_put(self) -> Self
pub fn and_method_put(self) -> Self
Add a new matcher that also matches MethodMatcher::PUT
on top of the existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn or_method_put(self) -> Self
pub fn or_method_put(self) -> Self
Add a new matcher that can also match MethodMatcher::PUT
as an alternative tothe existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn method_trace() -> Self
pub fn method_trace() -> Self
Create a new matcher that matches MethodMatcher::TRACE
requests.
See MethodMatcher
for more information.
Sourcepub fn and_method_trace(self) -> Self
pub fn and_method_trace(self) -> Self
Add a new matcher that also matches MethodMatcher::TRACE
on top of the existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn or_method_trace(self) -> Self
pub fn or_method_trace(self) -> Self
Add a new matcher that can also match MethodMatcher::TRACE
as an alternative tothe existing HttpMatcher
matchers.
See MethodMatcher
for more information.
Sourcepub fn domain(domain: Domain) -> Self
pub fn domain(domain: Domain) -> Self
Create a DomainMatcher
matcher, matching on the exact given Domain
.
Sourcepub fn subdomain(domain: Domain) -> Self
pub fn subdomain(domain: Domain) -> Self
Create a DomainMatcher
matcher, matching on the exact given Domain
or a subdomain of it.
Sourcepub fn and_domain(self, domain: Domain) -> Self
pub fn and_domain(self, domain: Domain) -> Self
Create a DomainMatcher
matcher to also match on top of the existing set of HttpMatcher
matchers.
See Self::domain
for more information.
Sourcepub fn and_subdomain(self, domain: Domain) -> Self
pub fn and_subdomain(self, domain: Domain) -> Self
Create a sub DomainMatcher
matcher to also match on top of the existing set of HttpMatcher
matchers.
See Self::subdomain
for more information.
Sourcepub fn or_domain(self, domain: Domain) -> Self
pub fn or_domain(self, domain: Domain) -> Self
Create a DomainMatcher
matcher to match as an alternative to the existing set of HttpMatcher
matchers.
See Self::domain
for more information.
Sourcepub fn or_subdomain(self, domain: Domain) -> Self
pub fn or_subdomain(self, domain: Domain) -> Self
Create a sub DomainMatcher
matcher to match as an alternative to the existing set of HttpMatcher
matchers.
See Self::subdomain
for more information.
Sourcepub fn version(version: VersionMatcher) -> Self
pub fn version(version: VersionMatcher) -> Self
Create a VersionMatcher
matcher.
Sourcepub fn and_version(self, version: VersionMatcher) -> Self
pub fn and_version(self, version: VersionMatcher) -> Self
Add a VersionMatcher
matcher to matcher on top of the existing set of HttpMatcher
matchers.
See VersionMatcher
for more information.
Sourcepub fn or_version(self, version: VersionMatcher) -> Self
pub fn or_version(self, version: VersionMatcher) -> Self
Create a VersionMatcher
matcher to match as an alternative to the existing set of HttpMatcher
matchers.
See VersionMatcher
for more information.
Sourcepub fn uri(re: impl AsRef<str>) -> Self
pub fn uri(re: impl AsRef<str>) -> Self
Create a UriMatcher
matcher.
Sourcepub fn and_uri(self, re: impl AsRef<str>) -> Self
pub fn and_uri(self, re: impl AsRef<str>) -> Self
Create a UriMatcher
matcher to match on top of the existing set of HttpMatcher
matchers.
See UriMatcher
for more information.
Sourcepub fn or_uri(self, re: impl AsRef<str>) -> Self
pub fn or_uri(self, re: impl AsRef<str>) -> Self
Create a UriMatcher
matcher to match as an alternative to the existing set of HttpMatcher
matchers.
See UriMatcher
for more information.
Sourcepub fn path(path: impl AsRef<str>) -> Self
pub fn path(path: impl AsRef<str>) -> Self
Create a PathMatcher
matcher.
Sourcepub fn and_path(self, path: impl AsRef<str>) -> Self
pub fn and_path(self, path: impl AsRef<str>) -> Self
Add a PathMatcher
to match on top of the existing set of HttpMatcher
matchers.
See PathMatcher
for more information.
Sourcepub fn or_path(self, path: impl AsRef<str>) -> Self
pub fn or_path(self, path: impl AsRef<str>) -> Self
Create a PathMatcher
matcher to match as an alternative to the existing set of HttpMatcher
matchers.
See PathMatcher
for more information.
Sourcepub fn header(name: HeaderName, value: HeaderValue) -> Self
pub fn header(name: HeaderName, value: HeaderValue) -> Self
Create a HeaderMatcher
matcher.
Sourcepub fn and_header(self, name: HeaderName, value: HeaderValue) -> Self
pub fn and_header(self, name: HeaderName, value: HeaderValue) -> Self
Add a HeaderMatcher
to match on top of the existing set of HttpMatcher
matchers.
See HeaderMatcher
for more information.
Sourcepub fn or_header(self, name: HeaderName, value: HeaderValue) -> Self
pub fn or_header(self, name: HeaderName, value: HeaderValue) -> Self
Create a HeaderMatcher
matcher to match as an alternative to the existing set of HttpMatcher
matchers.
See HeaderMatcher
for more information.
Sourcepub fn header_exists(name: HeaderName) -> Self
pub fn header_exists(name: HeaderName) -> Self
Create a HeaderMatcher
matcher when the given header exists
to match on the existence of a header.
Sourcepub fn and_header_exists(self, name: HeaderName) -> Self
pub fn and_header_exists(self, name: HeaderName) -> Self
Add a HeaderMatcher
to match when the given header exists
on top of the existing set of HttpMatcher
matchers.
See HeaderMatcher
for more information.
Sourcepub fn or_header_exists(self, name: HeaderName) -> Self
pub fn or_header_exists(self, name: HeaderName) -> Self
Create a HeaderMatcher
matcher to match when the given header exists
as an alternative to the existing set of HttpMatcher
matchers.
See HeaderMatcher
for more information.
Sourcepub fn header_contains(name: HeaderName, value: HeaderValue) -> Self
pub fn header_contains(name: HeaderName, value: HeaderValue) -> Self
Create a HeaderMatcher
matcher to match on it containing the given value.
Sourcepub fn and_header_contains(self, name: HeaderName, value: HeaderValue) -> Self
pub fn and_header_contains(self, name: HeaderName, value: HeaderValue) -> Self
Add a HeaderMatcher
to match when it contains the given value
on top of the existing set of HttpMatcher
matchers.
See HeaderMatcher
for more information.
Sourcepub fn or_header_contains(self, name: HeaderName, value: HeaderValue) -> Self
pub fn or_header_contains(self, name: HeaderName, value: HeaderValue) -> Self
Create a HeaderMatcher
matcher to match if it contains the given value
as an alternative to the existing set of HttpMatcher
matchers.
See HeaderMatcher
for more information.
Sourcepub fn socket(socket: SocketMatcher<State, Request<Body>>) -> Self
pub fn socket(socket: SocketMatcher<State, Request<Body>>) -> Self
Create a SocketMatcher
matcher.
Sourcepub fn and_socket(self, socket: SocketMatcher<State, Request<Body>>) -> Self
pub fn and_socket(self, socket: SocketMatcher<State, Request<Body>>) -> Self
Add a SocketMatcher
matcher to match on top of the existing set of HttpMatcher
matchers.
See SocketMatcher
for more information.
Sourcepub fn or_socket(self, socket: SocketMatcher<State, Request<Body>>) -> Self
pub fn or_socket(self, socket: SocketMatcher<State, Request<Body>>) -> Self
Create a SocketMatcher
matcher to match as an alternative to the existing set of HttpMatcher
matchers.
See SocketMatcher
for more information.
Sourcepub fn get(path: impl AsRef<str>) -> Self
pub fn get(path: impl AsRef<str>) -> Self
Create a PathMatcher
matcher to match for a GET request.
Sourcepub fn custom<M>(matcher: M) -> Self
pub fn custom<M>(matcher: M) -> Self
Create a matcher that matches according to a custom predicate.
See rama_core::matcher::Matcher
for more information.
Sourcepub fn and_custom<M>(self, matcher: M) -> Self
pub fn and_custom<M>(self, matcher: M) -> Self
Add a custom matcher to match on top of the existing set of HttpMatcher
matchers.
See rama_core::matcher::Matcher
for more information.
Sourcepub fn or_custom<M>(self, matcher: M) -> Self
pub fn or_custom<M>(self, matcher: M) -> Self
Create a custom matcher to match as an alternative to the existing set of HttpMatcher
matchers.
See rama_core::matcher::Matcher
for more information.
Sourcepub fn post(path: impl AsRef<str>) -> Self
pub fn post(path: impl AsRef<str>) -> Self
Create a PathMatcher
matcher to match for a POST request.
Sourcepub fn put(path: impl AsRef<str>) -> Self
pub fn put(path: impl AsRef<str>) -> Self
Create a PathMatcher
matcher to match for a PUT request.
Sourcepub fn delete(path: impl AsRef<str>) -> Self
pub fn delete(path: impl AsRef<str>) -> Self
Create a PathMatcher
matcher to match for a DELETE request.
Sourcepub fn patch(path: impl AsRef<str>) -> Self
pub fn patch(path: impl AsRef<str>) -> Self
Create a PathMatcher
matcher to match for a PATCH request.
Sourcepub fn head(path: impl AsRef<str>) -> Self
pub fn head(path: impl AsRef<str>) -> Self
Create a PathMatcher
matcher to match for a HEAD request.
Sourcepub fn options(path: impl AsRef<str>) -> Self
pub fn options(path: impl AsRef<str>) -> Self
Create a PathMatcher
matcher to match for a OPTIONS request.
Sourcepub fn trace(path: impl AsRef<str>) -> Self
pub fn trace(path: impl AsRef<str>) -> Self
Create a PathMatcher
matcher to match for a TRACE request.
Sourcepub fn and(self, matcher: HttpMatcher<State, Body>) -> Self
pub fn and(self, matcher: HttpMatcher<State, Body>) -> Self
Add a HttpMatcher
to match on top of the existing set of HttpMatcher
matchers.
Sourcepub fn or(self, matcher: HttpMatcher<State, Body>) -> Self
pub fn or(self, matcher: HttpMatcher<State, Body>) -> Self
Create a HttpMatcher
matcher to match as an alternative to the existing set of HttpMatcher
matchers.
Trait Implementations§
Source§impl<State, Body> Clone for HttpMatcher<State, Body>
impl<State, Body> Clone for HttpMatcher<State, Body>
Source§impl<State, Body> Debug for HttpMatcher<State, Body>
impl<State, Body> Debug for HttpMatcher<State, Body>
Source§impl<State, Body> Matcher<State, Request<Body>> for HttpMatcher<State, Body>
impl<State, Body> Matcher<State, Request<Body>> for HttpMatcher<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
Source§fn or<M>(self, other: M) -> impl Matcher<State, Request>
fn or<M>(self, other: M) -> impl Matcher<State, Request>
Auto Trait Implementations§
impl<State, Body> !Freeze for HttpMatcher<State, Body>
impl<State, Body> !RefUnwindSafe for HttpMatcher<State, Body>
impl<State, Body> Send for HttpMatcher<State, Body>
impl<State, Body> Sync for HttpMatcher<State, Body>
impl<State, Body> Unpin for HttpMatcher<State, Body>
impl<State, Body> !UnwindSafe for HttpMatcher<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
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>
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>
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