pub struct HealthComponentReport {
pub name: &'static str,
pub status: HealthStatus,
pub message: String,
pub duration: Option<Duration>,
pub details: Vec<HealthComponentDetail>,
}Expand description
Health status for one named component.
Fields§
§name: &'static strStable component name, such as database, cache, or storage.
status: HealthStatusComponent status.
message: StringHuman-facing diagnostic message.
duration: Option<Duration>Duration spent running this component check.
details: Vec<HealthComponentDetail>Optional structured diagnostics.
Implementations§
Source§impl HealthComponentReport
impl HealthComponentReport
Sourcepub fn healthy(name: &'static str, message: impl Into<String>) -> Self
pub fn healthy(name: &'static str, message: impl Into<String>) -> Self
Builds a healthy component report.
Sourcepub fn degraded(name: &'static str, message: impl Into<String>) -> Self
pub fn degraded(name: &'static str, message: impl Into<String>) -> Self
Builds a degraded component report.
Sourcepub fn unhealthy(name: &'static str, message: impl Into<String>) -> Self
pub fn unhealthy(name: &'static str, message: impl Into<String>) -> Self
Builds an unhealthy component report.
Sourcepub fn with_duration(self, duration: Duration) -> Self
pub fn with_duration(self, duration: Duration) -> Self
Returns this report with runtime duration attached.
Sourcepub fn with_detail(
self,
key: impl Into<String>,
value: impl Into<HealthComponentDetailValue>,
) -> Self
pub fn with_detail( self, key: impl Into<String>, value: impl Into<HealthComponentDetailValue>, ) -> Self
Returns this report with a structured diagnostic detail appended.
Sourcepub fn detail(&self, key: &str) -> Option<&HealthComponentDetailValue>
pub fn detail(&self, key: &str) -> Option<&HealthComponentDetailValue>
Returns the first structured detail value for key.
Sourcepub fn duration_seconds(&self) -> Option<f64>
pub fn duration_seconds(&self) -> Option<f64>
Returns component duration in seconds, if present.
Trait Implementations§
Source§impl Clone for HealthComponentReport
impl Clone for HealthComponentReport
Source§fn clone(&self) -> HealthComponentReport
fn clone(&self) -> HealthComponentReport
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HealthComponentReport
impl Debug for HealthComponentReport
Source§impl PartialEq for HealthComponentReport
impl PartialEq for HealthComponentReport
Source§fn eq(&self, other: &HealthComponentReport) -> bool
fn eq(&self, other: &HealthComponentReport) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for HealthComponentReport
impl StructuralPartialEq for HealthComponentReport
Auto Trait Implementations§
impl Freeze for HealthComponentReport
impl RefUnwindSafe for HealthComponentReport
impl Send for HealthComponentReport
impl Sync for HealthComponentReport
impl Unpin for HealthComponentReport
impl UnsafeUnpin for HealthComponentReport
impl UnwindSafe for HealthComponentReport
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.