pub struct MaintenanceLayer { /* private fields */ }Expand description
Maintenance-mode middleware configuration. Cheap to clone.
Implementations§
Source§impl MaintenanceLayer
impl MaintenanceLayer
Sourcepub fn new(flag: MaintenanceFlag) -> Self
pub fn new(flag: MaintenanceFlag) -> Self
Layer driven by flag. Retry-After defaults to 60 s and the
body to a 503 ApiError.
pub fn retry_after(self, d: Duration) -> Self
Sourcepub fn body(self, body: impl Into<String>) -> Self
pub fn body(self, body: impl Into<String>) -> Self
Set the body returned during maintenance. It is sent as
application/json and is not validated, so pass valid JSON.
Sourcepub fn allow_path(self, path: impl Into<String>) -> Self
pub fn allow_path(self, path: impl Into<String>) -> Self
Add an exact path that stays up during maintenance, usually
/health or /ready.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MaintenanceLayer
impl RefUnwindSafe for MaintenanceLayer
impl Send for MaintenanceLayer
impl Sync for MaintenanceLayer
impl Unpin for MaintenanceLayer
impl UnsafeUnpin for MaintenanceLayer
impl UnwindSafe for MaintenanceLayer
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,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more