pub struct AllowOrigin(/* private fields */);
Expand description
Holds configuration for how to set the Access-Control-Allow-Origin
header.
See CorsLayer::allow_origin
for more details.
Implementations§
Source§impl AllowOrigin
impl AllowOrigin
Sourcepub fn any() -> AllowOrigin
pub fn any() -> AllowOrigin
Allow any origin by sending a wildcard (*
)
See CorsLayer::allow_origin
for more details.
Sourcepub fn exact(origin: HeaderValue) -> AllowOrigin
pub fn exact(origin: HeaderValue) -> AllowOrigin
Set a single allowed origin
See CorsLayer::allow_origin
for more details.
Sourcepub fn list<I>(origins: I) -> AllowOriginwhere
I: IntoIterator<Item = HeaderValue>,
pub fn list<I>(origins: I) -> AllowOriginwhere
I: IntoIterator<Item = HeaderValue>,
Set multiple allowed origins
See CorsLayer::allow_origin
for more details.
§Panics
If the iterator contains a wildcard (*
).
Sourcepub fn predicate<F>(f: F) -> AllowOrigin
pub fn predicate<F>(f: F) -> AllowOrigin
Set the allowed origins from a predicate
See CorsLayer::allow_origin
for more details.
Sourcepub fn async_predicate<F, Fut>(f: F) -> AllowOrigin
pub fn async_predicate<F, Fut>(f: F) -> AllowOrigin
Set the allowed origins from an async predicate
See CorsLayer::allow_origin
for more details.
Sourcepub fn mirror_request() -> AllowOrigin
pub fn mirror_request() -> AllowOrigin
Allow any origin, by mirroring the request origin
This is equivalent to
AllowOrigin::predicate(|_, _| true)
.
See CorsLayer::allow_origin
for more details.
Trait Implementations§
Source§impl Clone for AllowOrigin
impl Clone for AllowOrigin
Source§fn clone(&self) -> AllowOrigin
fn clone(&self) -> AllowOrigin
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for AllowOrigin
impl Debug for AllowOrigin
Source§impl Default for AllowOrigin
impl Default for AllowOrigin
Source§fn default() -> AllowOrigin
fn default() -> AllowOrigin
Returns the “default value” for a type. Read more
Source§impl<const N: usize> From<[HeaderValue; N]> for AllowOrigin
impl<const N: usize> From<[HeaderValue; N]> for AllowOrigin
Source§fn from(arr: [HeaderValue; N]) -> AllowOrigin
fn from(arr: [HeaderValue; N]) -> AllowOrigin
Converts to this type from the input type.
Source§impl From<Any> for AllowOrigin
impl From<Any> for AllowOrigin
Source§fn from(_: Any) -> AllowOrigin
fn from(_: Any) -> AllowOrigin
Converts to this type from the input type.
Source§impl From<HeaderValue> for AllowOrigin
impl From<HeaderValue> for AllowOrigin
Source§fn from(val: HeaderValue) -> AllowOrigin
fn from(val: HeaderValue) -> AllowOrigin
Converts to this type from the input type.
Source§impl From<Vec<HeaderValue>> for AllowOrigin
impl From<Vec<HeaderValue>> for AllowOrigin
Source§fn from(vec: Vec<HeaderValue>) -> AllowOrigin
fn from(vec: Vec<HeaderValue>) -> AllowOrigin
Converts to this type from the input type.
Auto Trait Implementations§
impl !Freeze for AllowOrigin
impl !RefUnwindSafe for AllowOrigin
impl Send for AllowOrigin
impl Sync for AllowOrigin
impl Unpin for AllowOrigin
impl !UnwindSafe for AllowOrigin
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
Mutably borrows from an owned value. Read more