[−][src]Struct tide::middleware::Cors
Middleware for CORS
Example
use http::header::HeaderValue; use tide::middleware::{Cors, Origin}; Cors::new() .allow_methods(HeaderValue::from_static("GET, POST, OPTIONS")) .allow_origin(Origin::from("*")) .allow_credentials(false);
Methods
impl Cors
[src]
pub fn new() -> Self
[src]
Creates a new Cors middleware.
pub fn allow_credentials(self, allow_credentials: bool) -> Self
[src]
Set allow_credentials and return new Cors
pub fn allow_headers<T: Into<HeaderValue>>(self, headers: T) -> Self
[src]
Set allow_headers and return new Cors
pub fn max_age<T: Into<HeaderValue>>(self, max_age: T) -> Self
[src]
Set max_age and return new Cors
pub fn allow_methods<T: Into<HeaderValue>>(self, methods: T) -> Self
[src]
Set allow_methods and return new Cors
pub fn allow_origin<T: Into<Origin>>(self, origin: T) -> Self
[src]
Set allow_origin and return new Cors
pub fn expose_headers<T: Into<HeaderValue>>(self, headers: T) -> Self
[src]
Set expose_headers and return new Cors
Trait Implementations
impl Clone for Cors
[src]
impl Debug for Cors
[src]
impl Default for Cors
[src]
impl Hash for Cors
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<State: Send + Sync + 'static> Middleware<State> for Cors
[src]
Auto Trait Implementations
impl RefUnwindSafe for Cors
impl Send for Cors
impl Sync for Cors
impl Unpin for Cors
impl UnwindSafe for Cors
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<State, F> Middleware<State> for F where
F: Send + Sync + 'static + Fn(Request<State>, Next<'a, State>) -> Pin<Box<dyn Future<Output = Response> + 'a + Send>>,
[src]
F: Send + Sync + 'static + Fn(Request<State>, Next<'a, State>) -> Pin<Box<dyn Future<Output = Response> + 'a + Send>>,
fn handle(
&'a Self,
Request<State>,
Next<'a, State>
) -> Pin<Box<dyn Future<Output = Response> + 'a + Send>>
[src]
&'a Self,
Request<State>,
Next<'a, State>
) -> Pin<Box<dyn Future<Output = Response> + 'a + Send>>
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>,