Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.
use super::funejson::Value; ← the fune runtime: the JSON value the test vectors use; fune build keeps it only where a signature takes one
/// A heartbeat as one check behind a status page component. Late is
/// degraded, not down: the job may still ping within its grace time, which is
/// what the grace time is for. A new heartbeat has proved nothing either way,
/// so it is None rather than a guess.
///
/// # Panics
/// Panics on an unknown state.
pub fn heartbeat_check(state: &str) -> Option<String> {
match state {
"new" => None,
"up" => Some("up".to_string()),
"late" => Some("degraded".to_string()),
"down" => Some("down".to_string()),
other => panic!("unknown heartbeat state: {}", other),
}
}
pub fn fune_vector(args: &[Value]) -> Value {
let state = args[0].as_str().to_string();
match heartbeat_check(&state) {
Some(s) => Value::str(&s),
None => Value::Null,
}
}