[−][src]Struct gotham::router::route::matcher::and::AndRouteMatcher
Allows multiple RouteMatcher
values to be combined when accessing a request.
Examples
AndRouteMatcher, AcceptHeaderRouteMatcher}; let methods = vec![Method::GET, Method::HEAD]; let supported_media_types = vec![mime::APPLICATION_JSON]; let method_matcher = MethodOnlyRouteMatcher::new(methods); let accept_matcher = AcceptHeaderRouteMatcher::new(supported_media_types); let matcher = AndRouteMatcher::new(method_matcher, accept_matcher); state.put(Method::GET); // Request that matches both requirements let mut headers = HeaderMap::new(); headers.insert(ACCEPT, mime::APPLICATION_JSON.to_string().parse().unwrap()); state.put(headers); assert!(matcher.is_match(&state).is_ok()); // Request that fails method requirements state.put(Method::POST); assert!(matcher.is_match(&state).is_err()); // Request that fails accept header state.put(Method::GET); let mut headers = HeaderMap::new(); headers.insert(ACCEPT, mime::TEXT.to_string().parse().unwrap()); state.put(headers); assert!(matcher.is_match(&state).is_err());
Implementations
impl<T, U> AndRouteMatcher<T, U> where
T: RouteMatcher,
U: RouteMatcher,
[src]
T: RouteMatcher,
U: RouteMatcher,
Trait Implementations
impl<T: Clone, U: Clone> Clone for AndRouteMatcher<T, U> where
T: RouteMatcher,
U: RouteMatcher,
[src]
T: RouteMatcher,
U: RouteMatcher,
fn clone(&self) -> AndRouteMatcher<T, U>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T, U> RouteMatcher for AndRouteMatcher<T, U> where
T: RouteMatcher,
U: RouteMatcher,
[src]
T: RouteMatcher,
U: RouteMatcher,
Auto Trait Implementations
impl<T, U> RefUnwindSafe for AndRouteMatcher<T, U>
impl<T, U> Send for AndRouteMatcher<T, U> where
T: Send,
U: Send,
T: Send,
U: Send,
impl<T, U> Sync for AndRouteMatcher<T, U> where
T: Sync,
U: Sync,
T: Sync,
U: Sync,
impl<T, U> Unpin for AndRouteMatcher<T, U> where
T: Unpin,
U: Unpin,
T: Unpin,
U: Unpin,
impl<T, U> UnwindSafe for AndRouteMatcher<T, U> where
T: UnwindSafe,
U: UnwindSafe,
T: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<M> IntoRouteMatcher for M where
M: RouteMatcher + Send + Sync + 'static,
[src]
M: RouteMatcher + Send + Sync + 'static,
type Output = M
The concrete RouteMatcher each implementation will provide.
fn into_route_matcher(Self) -> <M as IntoRouteMatcher>::Output
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,