pub struct Cors { /* private fields */ }Expand description
CORS middleware - adds CORS headers
Implementations§
Source§impl Cors
impl Cors
Sourcepub fn permissive() -> Self
pub fn permissive() -> Self
Create a new CORS middleware with permissive settings
Sourcepub fn new(allow_origin: impl Into<String>) -> Self
pub fn new(allow_origin: impl Into<String>) -> Self
Create a new CORS middleware with custom origin
Sourcepub fn allow_methods(self, methods: Vec<String>) -> Self
pub fn allow_methods(self, methods: Vec<String>) -> Self
Set allowed methods
Sourcepub fn allow_headers(self, headers: Vec<String>) -> Self
pub fn allow_headers(self, headers: Vec<String>) -> Self
Set allowed headers
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cors
impl RefUnwindSafe for Cors
impl Send for Cors
impl Sync for Cors
impl Unpin 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