[−][src]Struct rocket_cors::Cors
Response generator and Fairing for CORS
This struct can be as Fairing or in an ad-hoc manner to generate CORS response. See the documentation at the crate root for usage information.
This struct can be created by using CorsOptions::to_cors
or Cors::from_options
.
Methods
impl Cors
[src]
pub fn from_options(options: &CorsOptions) -> Result<Self, Error>
[src]
Create a Cors
struct from a CorsOptions
pub fn respond_owned<'r, F, R>(
self,
handler: F
) -> Result<ManualResponder<'r, F, R>, Error> where
F: FnOnce(Guard<'r>) -> R + 'r,
R: Responder<'r>,
[src]
self,
handler: F
) -> Result<ManualResponder<'r, F, R>, Error> where
F: FnOnce(Guard<'r>) -> R + 'r,
R: Responder<'r>,
Manually respond to a request with CORS checks and headers using an Owned Cors
.
Use this variant when your Cors
struct will not live at least as long as the whole 'r
lifetime of the request.
After the CORS checks are done, the passed in handler closure will be run to generate a
final response. You will have to merge your response with the Guard
that you have been
passed in to include the CORS headers.
See the documentation at the crate root for usage information.
pub fn respond_borrowed<'r, F, R>(
&'r self,
handler: F
) -> Result<ManualResponder<'r, F, R>, Error> where
F: FnOnce(Guard<'r>) -> R + 'r,
R: Responder<'r>,
[src]
&'r self,
handler: F
) -> Result<ManualResponder<'r, F, R>, Error> where
F: FnOnce(Guard<'r>) -> R + 'r,
R: Responder<'r>,
Manually respond to a request with CORS checks and headers using a borrowed Cors
.
Use this variant when your Cors
struct will live at least as long as the whole 'r
lifetime of the request. If you are getting your Cors
from Rocket's state, you will have
to use the inner
function
to get a longer borrowed lifetime.
After the CORS checks are done, the passed in handler closure will be run to generate a
final response. You will have to merge your response with the Guard
that you have been
passed in to include the CORS headers.
See the documentation at the crate root for usage information.
Trait Implementations
impl Clone for Cors
[src]
fn clone(&self) -> Cors
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Cors
[src]
impl Fairing for Cors
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Typeable for T where
T: Any,
T: Any,
impl<T> IntoCollection 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 for T where
I: Input,
I: Input,