Struct HttpMatcher

pub struct HttpMatcher<Body> { /* private fields */ }
Expand description

A matcher that is used to match an http Request

Implementations§

§

impl<Body> HttpMatcher<Body>

pub fn method(method: MethodMatcher) -> HttpMatcher<Body>

Create a new matcher that matches one or more HTTP methods.

See MethodMatcher for more information.

pub fn and_method(self, method: MethodMatcher) -> HttpMatcher<Body>

Create a matcher that also matches one or more HTTP methods on top of the existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn or_method(self, method: MethodMatcher) -> HttpMatcher<Body>

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.

pub fn method_delete() -> HttpMatcher<Body>

Create a new matcher that matches MethodMatcher::DELETE requests.

See MethodMatcher for more information.

pub fn and_method_delete(self) -> HttpMatcher<Body>

Add a new matcher that also matches MethodMatcher::DELETE on top of the existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn or_method_delete(self) -> HttpMatcher<Body>

Add a new matcher that can also match MethodMatcher::DELETE as an alternative tothe existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn method_get() -> HttpMatcher<Body>

Create a new matcher that matches MethodMatcher::GET requests.

See MethodMatcher for more information.

pub fn and_method_get(self) -> HttpMatcher<Body>

Add a new matcher that also matches MethodMatcher::GET on top of the existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn or_method_get(self) -> HttpMatcher<Body>

Add a new matcher that can also match MethodMatcher::GET as an alternative tothe existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn method_head() -> HttpMatcher<Body>

Create a new matcher that matches MethodMatcher::HEAD requests.

See MethodMatcher for more information.

pub fn and_method_head(self) -> HttpMatcher<Body>

Add a new matcher that also matches MethodMatcher::HEAD on top of the existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn or_method_head(self) -> HttpMatcher<Body>

Add a new matcher that can also match MethodMatcher::HEAD as an alternative tothe existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn method_options() -> HttpMatcher<Body>

Create a new matcher that matches MethodMatcher::OPTIONS requests.

See MethodMatcher for more information.

pub fn and_method_options(self) -> HttpMatcher<Body>

Add a new matcher that also matches MethodMatcher::OPTIONS on top of the existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn or_method_options(self) -> HttpMatcher<Body>

Add a new matcher that can also match MethodMatcher::OPTIONS as an alternative tothe existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn method_patch() -> HttpMatcher<Body>

Create a new matcher that matches MethodMatcher::PATCH requests.

See MethodMatcher for more information.

pub fn and_method_patch(self) -> HttpMatcher<Body>

Add a new matcher that also matches MethodMatcher::PATCH on top of the existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn or_method_patch(self) -> HttpMatcher<Body>

Add a new matcher that can also match MethodMatcher::PATCH as an alternative tothe existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn method_post() -> HttpMatcher<Body>

Create a new matcher that matches MethodMatcher::POST requests.

See MethodMatcher for more information.

pub fn and_method_post(self) -> HttpMatcher<Body>

Add a new matcher that also matches MethodMatcher::POST on top of the existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn or_method_post(self) -> HttpMatcher<Body>

Add a new matcher that can also match MethodMatcher::POST as an alternative tothe existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn method_put() -> HttpMatcher<Body>

Create a new matcher that matches MethodMatcher::PUT requests.

See MethodMatcher for more information.

pub fn and_method_put(self) -> HttpMatcher<Body>

Add a new matcher that also matches MethodMatcher::PUT on top of the existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn or_method_put(self) -> HttpMatcher<Body>

Add a new matcher that can also match MethodMatcher::PUT as an alternative tothe existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn method_trace() -> HttpMatcher<Body>

Create a new matcher that matches MethodMatcher::TRACE requests.

See MethodMatcher for more information.

pub fn and_method_trace(self) -> HttpMatcher<Body>

Add a new matcher that also matches MethodMatcher::TRACE on top of the existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn or_method_trace(self) -> HttpMatcher<Body>

Add a new matcher that can also match MethodMatcher::TRACE as an alternative tothe existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn method_connect() -> HttpMatcher<Body>

Create a new matcher that matches MethodMatcher::CONNECT requests.

See MethodMatcher for more information.

pub fn and_method_connect(self) -> HttpMatcher<Body>

Add a new matcher that also matches MethodMatcher::CONNECT on top of the existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn or_method_connect(self) -> HttpMatcher<Body>

Add a new matcher that can also match MethodMatcher::CONNECT as an alternative tothe existing HttpMatcher matchers.

See MethodMatcher for more information.

pub fn domain(domain: Domain) -> HttpMatcher<Body>

Create a DomainMatcher matcher, matching on the exact given Domain.

pub fn subdomain(domain: Domain) -> HttpMatcher<Body>

Create a DomainMatcher matcher, matching on the exact given Domain or a subdomain of it.

pub fn and_domain(self, domain: Domain) -> HttpMatcher<Body>

Create a DomainMatcher matcher to also match on top of the existing set of HttpMatcher matchers.

See Self::domain for more information.

pub fn and_subdomain(self, domain: Domain) -> HttpMatcher<Body>

Create a sub DomainMatcher matcher to also match on top of the existing set of HttpMatcher matchers.

See Self::subdomain for more information.

pub fn or_domain(self, domain: Domain) -> HttpMatcher<Body>

Create a DomainMatcher matcher to match as an alternative to the existing set of HttpMatcher matchers.

See Self::domain for more information.

pub fn or_subdomain(self, domain: Domain) -> HttpMatcher<Body>

Create a sub DomainMatcher matcher to match as an alternative to the existing set of HttpMatcher matchers.

See Self::subdomain for more information.

pub fn version(version: VersionMatcher) -> HttpMatcher<Body>

Create a VersionMatcher matcher.

pub fn and_version(self, version: VersionMatcher) -> HttpMatcher<Body>

Add a VersionMatcher matcher to matcher on top of the existing set of HttpMatcher matchers.

See VersionMatcher for more information.

pub fn or_version(self, version: VersionMatcher) -> HttpMatcher<Body>

Create a VersionMatcher matcher to match as an alternative to the existing set of HttpMatcher matchers.

See VersionMatcher for more information.

pub fn uri(re: impl AsRef<str>) -> HttpMatcher<Body>

Create a UriMatcher matcher.

pub fn and_uri(self, re: impl AsRef<str>) -> HttpMatcher<Body>

Create a UriMatcher matcher to match on top of the existing set of HttpMatcher matchers.

See UriMatcher for more information.

pub fn or_uri(self, re: impl AsRef<str>) -> HttpMatcher<Body>

Create a UriMatcher matcher to match as an alternative to the existing set of HttpMatcher matchers.

See UriMatcher for more information.

pub fn path(path: impl AsRef<str>) -> HttpMatcher<Body>

Create a PathMatcher matcher.

pub fn and_path(self, path: impl AsRef<str>) -> HttpMatcher<Body>

Add a PathMatcher to match on top of the existing set of HttpMatcher matchers.

See PathMatcher for more information.

pub fn or_path(self, path: impl AsRef<str>) -> HttpMatcher<Body>

Create a PathMatcher matcher to match as an alternative to the existing set of HttpMatcher matchers.

See PathMatcher for more information.

pub fn header(name: HeaderName, value: HeaderValue) -> HttpMatcher<Body>

Create a HeaderMatcher matcher.

pub fn and_header( self, name: HeaderName, value: HeaderValue, ) -> HttpMatcher<Body>

Add a HeaderMatcher to match on top of the existing set of HttpMatcher matchers.

See HeaderMatcher for more information.

pub fn or_header( self, name: HeaderName, value: HeaderValue, ) -> HttpMatcher<Body>

Create a HeaderMatcher matcher to match as an alternative to the existing set of HttpMatcher matchers.

See HeaderMatcher for more information.

pub fn header_exists(name: HeaderName) -> HttpMatcher<Body>

Create a HeaderMatcher matcher when the given header exists to match on the existence of a header.

pub fn and_header_exists(self, name: HeaderName) -> HttpMatcher<Body>

Add a HeaderMatcher to match when the given header exists on top of the existing set of HttpMatcher matchers.

See HeaderMatcher for more information.

pub fn or_header_exists(self, name: HeaderName) -> HttpMatcher<Body>

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.

pub fn header_contains( name: HeaderName, value: HeaderValue, ) -> HttpMatcher<Body>

Create a HeaderMatcher matcher to match on it containing the given value.

pub fn and_header_contains( self, name: HeaderName, value: HeaderValue, ) -> HttpMatcher<Body>

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.

pub fn or_header_contains( self, name: HeaderName, value: HeaderValue, ) -> HttpMatcher<Body>

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.

pub fn socket(socket: SocketMatcher<Request<Body>>) -> HttpMatcher<Body>

Create a SocketMatcher matcher.

pub fn and_socket( self, socket: SocketMatcher<Request<Body>>, ) -> HttpMatcher<Body>

Add a SocketMatcher matcher to match on top of the existing set of HttpMatcher matchers.

See SocketMatcher for more information.

pub fn or_socket( self, socket: SocketMatcher<Request<Body>>, ) -> HttpMatcher<Body>

Create a SocketMatcher matcher to match as an alternative to the existing set of HttpMatcher matchers.

See SocketMatcher for more information.

pub fn get(path: impl AsRef<str>) -> HttpMatcher<Body>

Create a PathMatcher matcher to match for a GET request.

pub fn custom<M>(matcher: M) -> HttpMatcher<Body>
where M: Matcher<Request<Body>>,

Create a matcher that matches according to a custom predicate.

See rama_core::matcher::Matcher for more information.

pub fn and_custom<M>(self, matcher: M) -> HttpMatcher<Body>
where M: Matcher<Request<Body>>,

Add a custom matcher to match on top of the existing set of HttpMatcher matchers.

See rama_core::matcher::Matcher for more information.

pub fn or_custom<M>(self, matcher: M) -> HttpMatcher<Body>
where M: Matcher<Request<Body>>,

Create a custom matcher to match as an alternative to the existing set of HttpMatcher matchers.

See rama_core::matcher::Matcher for more information.

pub fn any_subdomain<I, S>(domains: I) -> HttpMatcher<Body>
where I: IntoIterator<Item = S>, S: AsRef<str>,

Create a SubdomainTrieMatcher matcher that matches if the request domain is a subdomain of the provided domains.

See SubdomainTrieMatcher for more information.

pub fn and_any_subdomain<I, S>(self, domains: I) -> HttpMatcher<Body>
where I: IntoIterator<Item = S>, S: AsRef<str>,

Add a SubdomainTrieMatcher matcher that matches if the request domain is a subdomain of the provided domains on top of the existing set of HttpMatcher matchers.

See SubdomainTrieMatcher for more information.

pub fn or_any_subdomain<I, S>(self, domains: I) -> HttpMatcher<Body>
where I: IntoIterator<Item = S>, S: AsRef<str>,

Create a SubdomainTrieMatcher matcher that matches if the request domain is a subdomain of the provided domains as an alternative to the existing set of HttpMatcher matchers.

See SubdomainTrieMatcher for more information.

pub fn post(path: impl AsRef<str>) -> HttpMatcher<Body>

Create a PathMatcher matcher to match for a POST request.

pub fn put(path: impl AsRef<str>) -> HttpMatcher<Body>

Create a PathMatcher matcher to match for a PUT request.

pub fn delete(path: impl AsRef<str>) -> HttpMatcher<Body>

Create a PathMatcher matcher to match for a DELETE request.

pub fn patch(path: impl AsRef<str>) -> HttpMatcher<Body>

Create a PathMatcher matcher to match for a PATCH request.

pub fn head(path: impl AsRef<str>) -> HttpMatcher<Body>

Create a PathMatcher matcher to match for a HEAD request.

pub fn options(path: impl AsRef<str>) -> HttpMatcher<Body>

Create a PathMatcher matcher to match for a OPTIONS request.

pub fn trace(path: impl AsRef<str>) -> HttpMatcher<Body>

Create a PathMatcher matcher to match for a TRACE request.

pub fn connect(path: impl AsRef<str>) -> HttpMatcher<Body>

Create a PathMatcher matcher to match for a CONNECT request.

pub fn and(self, matcher: HttpMatcher<Body>) -> HttpMatcher<Body>

Add a HttpMatcher to match on top of the existing set of HttpMatcher matchers.

pub fn or(self, matcher: HttpMatcher<Body>) -> HttpMatcher<Body>

Create a HttpMatcher matcher to match as an alternative to the existing set of HttpMatcher matchers.

pub fn negate(self) -> HttpMatcher<Body>

Negate the current matcher

Trait Implementations§

§

impl<Body> Clone for HttpMatcher<Body>

§

fn clone(&self) -> HttpMatcher<Body>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<Body> Debug for HttpMatcher<Body>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<Body> Matcher<Request<Body>> for HttpMatcher<Body>
where Body: Send + 'static,

§

fn matches( &self, ext: Option<&mut Extensions>, ctx: &Context, req: &Request<Body>, ) -> bool

returns true on a match, false otherwise Read more
§

fn or<M>(self, other: M) -> impl Matcher<Request>
where Self: Sized, M: Matcher<Request>,

Provide an alternative matcher to match if the current one does not match.
§

fn and<M>(self, other: M) -> impl Matcher<Request>
where Self: Sized, M: Matcher<Request>,

Add another condition to match on top of the current one.
§

fn not(self) -> impl Matcher<Request>
where Self: Sized,

Negate the current condition.

Auto Trait Implementations§

§

impl<Body> !Freeze for HttpMatcher<Body>

§

impl<Body> !RefUnwindSafe for HttpMatcher<Body>

§

impl<Body> Send for HttpMatcher<Body>

§

impl<Body> Sync for HttpMatcher<Body>

§

impl<Body> Unpin for HttpMatcher<Body>

§

impl<Body> !UnwindSafe for HttpMatcher<Body>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
§

impl<T, U> RamaInto<U> for T
where U: RamaFrom<T>,

§

fn rama_into(self) -> U

§

impl<T, U> RamaInto<U> for T
where U: RamaFrom<T>,

§

fn rama_into(self) -> U

§

impl<T, U> RamaTryInto<U> for T
where U: RamaTryFrom<T>,

§

type Error = <U as RamaTryFrom<T>>::Error

§

fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T>>::Error>

§

impl<T, U> RamaTryInto<U> for T
where U: RamaTryFrom<T>,

§

type Error = <U as RamaTryFrom<T>>::Error

§

fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T>>::Error>

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,