servlet 1.2.0

A small application runtime with an explicit operational contract
Documentation
//! Health state is updated by check tasks, never by probe requests.
use std::{
    collections::{BTreeMap, BTreeSet},
    sync::Mutex,
};

pub(crate) struct Health(Mutex<BTreeMap<String, bool>>);
impl Health {
    pub(crate) fn new() -> Self {
        Self(Mutex::new(BTreeMap::new()))
    }
    pub(crate) fn set(&self, name: String, healthy: bool) {
        self.0
            .lock()
            .unwrap_or_else(|error| error.into_inner())
            .insert(name, healthy);
    }
    pub(crate) fn names(&self) -> BTreeSet<String> {
        self.0
            .lock()
            .unwrap_or_else(|error| error.into_inner())
            .keys()
            .cloned()
            .collect()
    }
    pub(crate) fn ready(&self) -> bool {
        self.0
            .lock()
            .unwrap_or_else(|error| error.into_inner())
            .values()
            .all(|healthy| *healthy)
    }
}