pub static HEALTH_CHECKS: DistributedSlice<[fn() -> Box<dyn HealthCheck>]>Expand description
Link-time registry of health-check factories.
use rtb_app::app::App;
use rtb_app::linkme::distributed_slice;
use rtb_cli::health::{HealthCheck, HealthStatus, HEALTH_CHECKS};
struct MyCheck;
#[async_trait::async_trait]
impl HealthCheck for MyCheck {
fn name(&self) -> &'static str {
"my-check"
}
async fn check(&self, _app: &App) -> HealthStatus {
HealthStatus::ok("everything is fine")
}
}
#[distributed_slice(HEALTH_CHECKS)]
fn register() -> Box<dyn HealthCheck> { Box::new(MyCheck) }