pub struct CorsPolicy {
pub allowed_origins: Vec<String>,
pub allowed_methods: Vec<String>,
pub allowed_headers: Vec<String>,
pub allow_credentials: bool,
pub max_age: Option<Duration>,
}
Expand description
CORS policy configuration
Fields§
§allowed_origins: Vec<String>
§allowed_methods: Vec<String>
§allowed_headers: Vec<String>
§allow_credentials: bool
§max_age: Option<Duration>
Implementations§
Source§impl CorsPolicy
impl CorsPolicy
Sourcepub fn permissive() -> Self
pub fn permissive() -> Self
Create a permissive CORS policy (allows all origins)
Sourcepub fn allow_origin(self, origin: impl Into<String>) -> Self
pub fn allow_origin(self, origin: impl Into<String>) -> Self
Add allowed origin
Sourcepub fn allow_method(self, method: impl Into<String>) -> Self
pub fn allow_method(self, method: impl Into<String>) -> Self
Add allowed method
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 · 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
Source§impl<'de> Deserialize<'de> for CorsPolicy
impl<'de> Deserialize<'de> for CorsPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CorsPolicy
impl RefUnwindSafe for CorsPolicy
impl Send for CorsPolicy
impl Sync for CorsPolicy
impl Unpin 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