[][src]Struct tide::middleware::Cors

pub struct Cors { /* fields omitted */ }

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]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.