[−][src]Function health::check_fn
pub fn check_fn<F, E>(name: impl Into<String>, f: F) -> FnCheck<F> where
F: Fn() -> Result<(), E> + Send + Sync + 'static,
E: StdError + Send + Sync + 'static,
Wraps a synchronous function as a checkable source for health checks
Example
use health::Checkable; fn all_is_well() -> Result<(), Error> { Ok(()) } fn everything_is_fire() -> Result<(), Error> { Err(Error {}) } let always_ok = health::check_fn("ok", all_is_well); assert_eq!(Ok(()), block_on(always_ok.check())); let always_err = health::check_fn("err", everything_is_fire); assert_eq!(Err(Error {}), block_on(always_err.check()));