pub struct CorsPolicy {
pub origins: AllowedOrigins,
pub methods: Vec<Method>,
pub allow_headers: Vec<HeaderName>,
pub expose_headers: Vec<HeaderName>,
pub allow_credentials: bool,
pub max_age: Option<Duration>,
}Expand description
Declarative cross-origin resource-sharing policy.
Fields§
§origins: AllowedOriginsOrigins permitted by the resource.
methods: Vec<Method>Methods permitted for cross-origin requests.
allow_headers: Vec<HeaderName>Request headers permitted by preflight responses.
expose_headers: Vec<HeaderName>Response headers exposed to browser code.
allow_credentials: boolWhether credentialed browser requests are allowed.
max_age: Option<Duration>Optional browser preflight cache duration.
Implementations§
Source§impl CorsPolicy
impl CorsPolicy
Sourcepub fn any(methods: Vec<Method>) -> SoapResult<Self>
pub fn any(methods: Vec<Method>) -> SoapResult<Self>
Creates a public CORS policy without credentials.
Sourcepub fn exact<I, S>(origins: I, methods: Vec<Method>) -> SoapResult<Self>
pub fn exact<I, S>(origins: I, methods: Vec<Method>) -> SoapResult<Self>
Creates an exact-origin CORS policy.
Sourcepub fn allow_credentials(self) -> SoapResult<Self>
pub fn allow_credentials(self) -> SoapResult<Self>
Allows browser credentials for an exact-origin policy.
Sourcepub fn allow_headers(self, headers: Vec<HeaderName>) -> Self
pub fn allow_headers(self, headers: Vec<HeaderName>) -> Self
Sets headers accepted in cross-origin requests.
Sourcepub fn expose_headers(self, headers: Vec<HeaderName>) -> Self
pub fn expose_headers(self, headers: Vec<HeaderName>) -> Self
Sets headers exposed to browser code.
Sourcepub fn max_age(self, max_age: Duration) -> SoapResult<Self>
pub fn max_age(self, max_age: Duration) -> SoapResult<Self>
Sets a non-zero browser preflight cache duration.
Sourcepub fn validate(&self) -> SoapResult<()>
pub fn validate(&self) -> SoapResult<()>
Validates invariants after direct public-field mutation.
Trait Implementations§
Source§impl Clone for CorsPolicy
impl Clone for CorsPolicy
Source§fn clone(&self) -> CorsPolicy
fn clone(&self) -> CorsPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 CorsPolicy
impl Debug for CorsPolicy
impl Eq for CorsPolicy
Source§impl PartialEq for CorsPolicy
impl PartialEq for CorsPolicy
impl StructuralPartialEq for CorsPolicy
Auto Trait Implementations§
impl Freeze for CorsPolicy
impl RefUnwindSafe for CorsPolicy
impl Send for CorsPolicy
impl Sync for CorsPolicy
impl Unpin for CorsPolicy
impl UnsafeUnpin for CorsPolicy
impl UnwindSafe for CorsPolicy
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