pub struct MaintenanceModeMiddleware { /* private fields */ }
Expand description
Maintenance mode middleware
Implementations§
Source§impl MaintenanceModeMiddleware
impl MaintenanceModeMiddleware
Sourcepub fn with_config(config: MaintenanceModeConfig) -> Self
pub fn with_config(config: MaintenanceModeConfig) -> Self
Create with custom configuration
Sourcepub fn enable(&self) -> Result<(), PoisonError<RwLockWriteGuard<'_, bool>>>
pub fn enable(&self) -> Result<(), PoisonError<RwLockWriteGuard<'_, bool>>>
Enable maintenance mode
Sourcepub fn disable(&self) -> Result<(), PoisonError<RwLockWriteGuard<'_, bool>>>
pub fn disable(&self) -> Result<(), PoisonError<RwLockWriteGuard<'_, bool>>>
Disable maintenance mode
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if maintenance mode is enabled
Sourcepub fn response(self, response: MaintenanceResponse) -> Self
pub fn response(self, response: MaintenanceResponse) -> Self
Set maintenance response
Sourcepub fn allow_path(self, path: impl Into<String>) -> Self
pub fn allow_path(self, path: impl Into<String>) -> Self
Add allowed path (exact match)
Sourcepub fn allow_prefix(self, prefix: impl Into<String>) -> Self
pub fn allow_prefix(self, prefix: impl Into<String>) -> Self
Add allowed path prefix
Sourcepub fn allow_regex(self, pattern: &str) -> Result<Self, Error>
pub fn allow_regex(self, pattern: &str) -> Result<Self, Error>
Add allowed path regex pattern
Sourcepub fn allow_custom(self, matcher: fn(&str) -> bool) -> Self
pub fn allow_custom(self, matcher: fn(&str) -> bool) -> Self
Add custom path matcher
Sourcepub fn allow_method(self, method: ElifMethod) -> Self
pub fn allow_method(self, method: ElifMethod) -> Self
Add allowed HTTP method
Sourcepub fn bypass_header(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn bypass_header( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
Set bypass header (name and expected value)
Sourcepub fn retry_after(self, seconds: u64) -> Self
pub fn retry_after(self, seconds: u64) -> Self
Set Retry-After header value in seconds
Sourcepub fn no_retry_after(self) -> Self
pub fn no_retry_after(self) -> Self
Disable Retry-After header
Trait Implementations§
Source§impl Debug for MaintenanceModeMiddleware
impl Debug for MaintenanceModeMiddleware
Source§impl Default for MaintenanceModeMiddleware
impl Default for MaintenanceModeMiddleware
Source§impl Middleware for MaintenanceModeMiddleware
impl Middleware for MaintenanceModeMiddleware
Source§fn handle(&self, request: ElifRequest, next: Next) -> NextFuture<'static>
fn handle(&self, request: ElifRequest, next: Next) -> NextFuture<'static>
Handle the request and call the next middleware in the chain
Auto Trait Implementations§
impl Freeze for MaintenanceModeMiddleware
impl RefUnwindSafe for MaintenanceModeMiddleware
impl Send for MaintenanceModeMiddleware
impl Sync for MaintenanceModeMiddleware
impl Unpin for MaintenanceModeMiddleware
impl UnwindSafe for MaintenanceModeMiddleware
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