#![no_std] use core::fmt; /// Creates an ad-hoc `Debug` instance. pub fn debug(f: impl Fn(&mut fmt::Formatter) -> fmt::Result) -> impl fmt::Debug { struct Debug(F); impl fmt::Result> fmt::Debug for Debug { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { (self.0)(fmt) } } Debug(f) }