pub struct AppStateBuilder { /* private fields */ }Expand description
Builder for constructing AppState with custom values
Implementations§
Source§impl AppStateBuilder
impl AppStateBuilder
Sourcepub fn with_value<T: Send + Sync + 'static>(self, key: &str, value: T) -> Self
pub fn with_value<T: Send + Sync + 'static>(self, key: &str, value: T) -> Self
Add a custom value to the state
Sourcepub fn with_allowed_origin(self, origin: impl Into<String>) -> Self
pub fn with_allowed_origin(self, origin: impl Into<String>) -> Self
Add an allowed CORS origin
Sourcepub fn with_allowed_origins(self, origins: Vec<String>) -> Self
pub fn with_allowed_origins(self, origins: Vec<String>) -> Self
Add multiple allowed CORS origins
Sourcepub fn with_allowed_method(self, method: Method) -> Self
pub fn with_allowed_method(self, method: Method) -> Self
Add an allowed HTTP method
Sourcepub fn with_allowed_methods(self, methods: Vec<Method>) -> Self
pub fn with_allowed_methods(self, methods: Vec<Method>) -> Self
Add multiple allowed HTTP methods
pub fn with_body_config(self, config: BodyConfig) -> Self
pub fn with_json_config(self, config: BodyConfig) -> Self
👎Deprecated since 0.31.0:
Use with_body_config instead
pub fn build(self) -> AppState
Auto Trait Implementations§
impl Freeze for AppStateBuilder
impl !RefUnwindSafe for AppStateBuilder
impl Send for AppStateBuilder
impl Sync for AppStateBuilder
impl Unpin for AppStateBuilder
impl UnsafeUnpin for AppStateBuilder
impl !UnwindSafe for AppStateBuilder
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