[][src]Struct tower_web::middleware::cors::CorsBuilder

pub struct CorsBuilder { /* fields omitted */ }

Build a configured CORS middleware instance.

Methods

impl CorsBuilder[src]

pub fn new() -> CorsBuilder[src]

Create a new CorsBuilder with default configuration.

By default, all operations are restricted.

pub fn allow_origins(self, origins: AllowedOrigins) -> Self[src]

Add origins which are allowed to access this resource

pub fn allow_methods<I>(self, methods: I) -> Self where
    I: IntoIterator,
    I::Item: Into<Method>, 
[src]

Add methods which are allowed to be performed on this resource

pub fn allow_headers<I>(self, headers: I) -> Self where
    I: IntoIterator,
    I::Item: Into<HeaderName>, 
[src]

Add headers which are allowed to be sent to this resource

pub fn allow_credentials(self, allow_credentials: bool) -> Self[src]

Whether to allow clients to send cookies to this resource or not

pub fn expose_headers<I>(self, headers: I) -> Self where
    I: IntoIterator,
    I::Item: Into<HeaderName>, 
[src]

Add headers which are allowed to be read from the response from this resource

pub fn max_age(self, max_age: Duration) -> Self[src]

Defines the maximum cache lifetime for operations allowed on this resource

pub fn prefer_wildcard(self, prefer_wildcard: bool) -> Self[src]

When set, the wildcard ('*') will be used as the value for AccessControlAllowOrigin. When not set, the incoming origin will be used.

If credentials are allowed, the incoming origin will always be used.

pub fn build(self) -> CorsMiddleware[src]

Build a CorsMiddleware instance.

Trait Implementations

impl Clone for CorsBuilder[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for CorsBuilder[src]

impl Debug for CorsBuilder[src]

Auto Trait Implementations

impl Send for CorsBuilder

impl Sync for CorsBuilder

Blanket Implementations

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

type Owned = T

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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

impl<T, U> TryInto 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<T> Same for T

type Output = T

Should always be Self

impl<T> Erased for T