[−][src]Struct rocket_cors::Guard
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]
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]
U: From<T>,
impl<T> From<T> for 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<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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Typeable for T where
T: Any,
T: Any,
impl<T> IntoCollection<T> for T
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
A: Array<Item = T>,
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
A: Array<Item = U>,
F: FnMut(T) -> U,
A: Array<Item = U>,
F: FnMut(T) -> U,
impl<T, I> AsResult<T, I> for T where
I: Input,
I: Input,