pub fn as_display<F: Fn(&mut Formatter<'_>) -> Result>(f: F) -> impl Display