[−][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
Auto Trait Implementations
impl Send for Cors
impl Sync for Cors
impl Unpin for Cors
impl UnwindSafe for Cors
impl !RefUnwindSafe for Cors
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> 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<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,