pub struct LivenessResponse {
pub status: HealthStatus,
pub version: String,
pub service_id: String,
}Expand description
Liveness probe response (GET /health) — RFC 8458.
Answers the question: “is this process alive?” No dependency checks.
Always returns HTTP 200 OK.
Requires std or alloc (fields contain String).
Fields§
§status: HealthStatusOverall health status. Should always be HealthStatus::Pass for liveness.
version: StringSemantic version of the service, e.g. "1.0.0".
service_id: StringUnique identifier for this service instance, e.g. "my-service".
Implementations§
Source§impl LivenessResponse
impl LivenessResponse
Sourcepub fn pass(version: impl Into<String>, service_id: impl Into<String>) -> Self
pub fn pass(version: impl Into<String>, service_id: impl Into<String>) -> Self
Create a passing liveness response.
§Examples
use api_bones::health::{LivenessResponse, HealthStatus};
let resp = LivenessResponse::pass("1.0.0", "my-service");
assert_eq!(resp.status, HealthStatus::Pass);
assert_eq!(resp.version, "1.0.0");
assert_eq!(resp.service_id, "my-service");Trait Implementations§
Source§impl Clone for LivenessResponse
impl Clone for LivenessResponse
Source§fn clone(&self) -> LivenessResponse
fn clone(&self) -> LivenessResponse
Returns a duplicate of the value. Read more
1.0.0 · 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 LivenessResponse
impl Debug for LivenessResponse
Source§impl<'de> Deserialize<'de> for LivenessResponse
impl<'de> Deserialize<'de> for LivenessResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for LivenessResponse
impl RefUnwindSafe for LivenessResponse
impl Send for LivenessResponse
impl Sync for LivenessResponse
impl Unpin for LivenessResponse
impl UnsafeUnpin for LivenessResponse
impl UnwindSafe for LivenessResponse
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