[][src]Struct tide::utils::Before

pub struct Before<F>(pub F);

Define a middleware that operates on incoming requests.

This middleware is useful because it is not possible in Rust yet to use closures to define inline middleware.

Examples

use tide::{utils, Request};
use std::time::Instant;

let mut app = tide::new();
app.with(utils::Before(|mut request: Request<()>| async move {
    request.set_ext(Instant::now());
    request
}));

Trait Implementations

impl<F: Debug> Debug for Before<F>[src]

impl<State, F, Fut> Middleware<State> for Before<F> where
    State: Clone + Send + Sync + 'static,
    F: Fn(Request<State>) -> Fut + Send + Sync + 'static,
    Fut: Future<Output = Request<State>> + Send + Sync + 'static, 
[src]

Auto Trait Implementations

impl<F> RefUnwindSafe for Before<F> where
    F: RefUnwindSafe
[src]

impl<F> Send for Before<F> where
    F: Send
[src]

impl<F> Sync for Before<F> where
    F: Sync
[src]

impl<F> Unpin for Before<F> where
    F: Unpin
[src]

impl<F> UnwindSafe for Before<F> where
    F: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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