[][src]Struct tide::security::CorsMiddleware

pub struct CorsMiddleware { /* fields omitted */ }

Middleware for CORS

Example

use http_types::headers::HeaderValue;
use tide::security::{CorsMiddleware, Origin};

let cors = CorsMiddleware::new()
    .allow_methods("GET, POST, OPTIONS".parse::<HeaderValue>().unwrap())
    .allow_origin(Origin::from("*"))
    .allow_credentials(false);

Implementations

impl CorsMiddleware[src]

#[must_use]pub fn new() -> Self[src]

Creates a new Cors middleware.

#[must_use]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 CorsMiddleware[src]

impl Debug for CorsMiddleware[src]

impl Default for CorsMiddleware[src]

impl Hash for CorsMiddleware[src]

impl<State: Clone + Send + Sync + 'static> Middleware<State> for CorsMiddleware[src]

Auto Trait Implementations

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<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,