use axum::http::StatusCode;
use axum::response::IntoResponse;
#[axum::async_trait]
pub trait HealthExt: Send + Sync + 'static + Clone {
type HealthResponse: IntoResponse;
type ReadyResponse: IntoResponse;
async fn alive(&self) -> Self::HealthResponse;
async fn ready(&self) -> Self::ReadyResponse;
}
#[derive(Default, Debug, Clone, Copy)]
pub struct AlwaysReadyAndAlive;
#[axum::async_trait]
impl HealthExt for AlwaysReadyAndAlive {
type HealthResponse = (StatusCode, &'static str);
type ReadyResponse = (StatusCode, &'static str);
async fn alive(&self) -> (StatusCode, &'static str) {
(StatusCode::OK, "OK")
}
async fn ready(&self) -> (StatusCode, &'static str) {
(StatusCode::OK, "OK")
}
}