pub struct Cors {
pub allow_all: bool,
pub allow_origins: Vec<String>,
pub allow_methods: Vec<String>,
pub allow_headers: Vec<String>,
pub allow_credentials: bool,
pub expose_headers: Vec<String>,
pub max_age: String,
}Fields§
§allow_all: bool§allow_origins: Vec<String>§allow_methods: Vec<String>§allow_headers: Vec<String>§allow_credentials: bool§expose_headers: Vec<String>§max_age: StringImplementations§
Source§impl Cors
impl Cors
pub const MAX_AGE: &'static str = "86400"
pub fn get_vary_header_value() -> String
pub fn allow_all(request: &Request) -> Result<Vec<Header>, Error>
pub fn _process(request: &Request, cors: &Cors) -> Result<Vec<Header>, Error>
Sourcepub fn get_headers_from_config(
request: &Request,
config: &ServerConfig,
) -> Vec<Header>
pub fn get_headers_from_config( request: &Request, config: &ServerConfig, ) -> Vec<Header>
Build CORS headers using the provided ServerConfig.
This is the primary implementation. [get_headers] is the legacy
entry point that reads from environment variables; all new call-sites
should prefer this version.
Sourcepub fn process_using_default_config(
request: &Request,
) -> Result<Vec<Header>, Error>
pub fn process_using_default_config( request: &Request, ) -> Result<Vec<Header>, Error>
Legacy entry point that reads CORS settings from environment variables.
Prefer [get_headers_from_config] when a ServerConfig is available
(e.g. inside [App::execute]). This variant is kept for call-sites that
do not yet have an App-level config reference.
Sourcepub fn get_headers(request: &Request) -> Vec<Header>
pub fn get_headers(request: &Request) -> Vec<Header>
Legacy entry point that reads CORS settings from environment variables.
Prefer [get_headers_from_config] when a ServerConfig is available.
Trait Implementations§
impl Eq for Cors
impl StructuralPartialEq for Cors
Auto Trait Implementations§
impl Freeze for Cors
impl RefUnwindSafe for Cors
impl Send for Cors
impl Sync for Cors
impl Unpin for Cors
impl UnsafeUnpin for Cors
impl UnwindSafe for Cors
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.