pub struct CorsBuilder { /* private fields */ }Expand description
Build a configured CORS middleware instance.
Implementations§
Source§impl CorsBuilder
impl CorsBuilder
Sourcepub fn new() -> CorsBuilder
pub fn new() -> CorsBuilder
Create a new CorsBuilder with default configuration.
By default, all operations are restricted.
Sourcepub fn allow_origins(self, origins: AllowedOrigins) -> Self
pub fn allow_origins(self, origins: AllowedOrigins) -> Self
Add origins which are allowed to access this resource
Sourcepub fn allow_methods<I>(self, methods: I) -> Self
pub fn allow_methods<I>(self, methods: I) -> Self
Add methods which are allowed to be performed on this resource
Sourcepub fn allow_headers<I>(self, headers: I) -> Self
pub fn allow_headers<I>(self, headers: I) -> Self
Add headers which are allowed to be sent to this resource
Sourcepub fn allow_credentials(self, allow_credentials: bool) -> Self
pub fn allow_credentials(self, allow_credentials: bool) -> Self
Whether to allow clients to send cookies to this resource or not
Sourcepub fn expose_headers<I>(self, headers: I) -> Self
pub fn expose_headers<I>(self, headers: I) -> Self
Add headers which are allowed to be read from the response from this resource
Sourcepub fn max_age(self, max_age: Duration) -> Self
pub fn max_age(self, max_age: Duration) -> Self
Defines the maximum cache lifetime for operations allowed on this resource
Sourcepub fn prefer_wildcard(self, prefer_wildcard: bool) -> Self
pub fn prefer_wildcard(self, prefer_wildcard: bool) -> Self
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.
Sourcepub fn build(self) -> CorsMiddleware
pub fn build(self) -> CorsMiddleware
Build a CorsMiddleware instance.
Trait Implementations§
Source§impl Clone for CorsBuilder
impl Clone for CorsBuilder
Source§fn clone(&self) -> CorsBuilder
fn clone(&self) -> CorsBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CorsBuilder
impl Debug for CorsBuilder
Source§impl Default for CorsBuilder
impl Default for CorsBuilder
Source§fn default() -> CorsBuilder
fn default() -> CorsBuilder
Auto Trait Implementations§
impl Freeze for CorsBuilder
impl RefUnwindSafe for CorsBuilder
impl Send for CorsBuilder
impl Sync for CorsBuilder
impl Unpin for CorsBuilder
impl UnwindSafe for CorsBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more