[][src]Struct rocket_cors::Guard

pub struct Guard<'r> { /* fields omitted */ }

A request guard to check CORS headers before a route is run. Will not execute the route if checks fail.

See the documentation at the crate root for usage information.

You should not wrap this in an Option or Result because the guard will let non-CORS requests through and will take over error handling in case of errors. In essence, this is just a wrapper around Response with a 'r borrowed lifetime so users don't have to keep specifying the lifetimes in their routes

Methods

impl<'r> Guard<'r>[src]

pub fn responder<R: Responder<'r>>(self, responder: R) -> Responder<'r, R>[src]

Consumes the Guard and return a Responder that wraps a provided rocket:response::Responder with CORS headers

pub fn response(&self, base: Response<'r>) -> Response<'r>[src]

Merge a rocket::Response with this CORS Guard. This is usually used in the final step of a route to return a value for the route.

This will overwrite any existing CORS headers

Trait Implementations

impl<'a, 'r> FromRequest<'a, 'r> for Guard<'r>[src]

type Error = Error

The associated error to be returned if derivation fails.

Auto Trait Implementations

impl<'r> Send for Guard<'r>

impl<'r> Sync for Guard<'r>

impl<'r> Unpin for Guard<'r>

impl<'r> UnwindSafe for Guard<'r>

impl<'r> RefUnwindSafe for Guard<'r>

Blanket Implementations

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

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

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Typeable for T where
    T: Any

impl<T> IntoCollection<T> for T

impl<T, I> AsResult<T, I> for T where
    I: Input,