[−][src]Struct warp::filters::cors::Cors
A wrapping filter constructed via warp::cors()
.
Methods
impl Cors
[src]
pub fn allow_credentials(self, allow: bool) -> Self
[src]
Sets whether to add the Access-Control-Allow-Credentials
header.
pub fn allow_method<M>(self, method: M) -> Self where
Method: HttpTryFrom<M>,
[src]
Method: HttpTryFrom<M>,
Adds a method to the existing list of allowed request methods.
Panics
Panics if the provided argument is not a valid http::Method
.
pub fn allow_methods<I>(self, methods: I) -> Self where
I: IntoIterator,
Method: HttpTryFrom<I::Item>,
[src]
I: IntoIterator,
Method: HttpTryFrom<I::Item>,
Adds multiple methods to the existing list of allowed request methods.
Panics
Panics if the provided argument is not a valid http::Method
.
pub fn allow_header<H>(self, header: H) -> Self where
HeaderName: HttpTryFrom<H>,
[src]
HeaderName: HttpTryFrom<H>,
Adds a header to the list of allowed request headers.
Panics
Panics if the provided argument is not a valid http::header::HeaderName
.
pub fn allow_headers<I>(self, headers: I) -> Self where
I: IntoIterator,
HeaderName: HttpTryFrom<I::Item>,
[src]
I: IntoIterator,
HeaderName: HttpTryFrom<I::Item>,
Adds multiple headers to the list of allowed request headers.
Panics
Panics if any of the headers are not a valid http::header::HeaderName
.
pub fn expose_header<H>(self, header: H) -> Self where
HeaderName: HttpTryFrom<H>,
[src]
HeaderName: HttpTryFrom<H>,
Adds a header to the list of exposed headers.
Panics
Panics if the provided argument is not a valid http::header::HeaderName
.
pub fn expose_headers<I>(self, headers: I) -> Self where
I: IntoIterator,
HeaderName: HttpTryFrom<I::Item>,
[src]
I: IntoIterator,
HeaderName: HttpTryFrom<I::Item>,
Adds multiple headers to the list of exposed headers.
Panics
Panics if any of the headers are not a valid http::header::HeaderName
.
pub fn allow_any_origin(self) -> Self
[src]
Sets that any Origin
header is allowed.
Warning
This can allow websites you didn't instead to access this resource, it is usually better to set an explicit list.
pub fn allow_origin(self, origin: impl IntoOrigin) -> Self
[src]
Add an origin to the existing list of allowed Origin
s.
Panics
Panics if the provided argument is not a valid Origin
.
pub fn allow_origins<I>(self, origins: I) -> Self where
I: IntoIterator,
I::Item: IntoOrigin,
[src]
I: IntoIterator,
I::Item: IntoOrigin,
Add multiple origins to the existing list of allowed Origin
s.
Panics
Panics if the provided argument is not a valid Origin
.
pub fn max_age(self, seconds: impl Seconds) -> Self
[src]
Sets the Access-Control-Max-Age
header.
Example
use std::time::Duration; use warp::Filter; let cors = warp::cors() .max_age(30) // 30u32 seconds .max_age(Duration::from_secs(30)); // or a Duration
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]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?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> Same for T
type Output = T
Should always be Self