debug_fn

Function debug_fn 

Source
pub fn debug_fn<F>(f: F) -> DebugFn<F>
where F: Fn(&mut Formatter<'_>) -> Result,
Expand description

Creates a type that implements Display and Debug from a closure.

ยงExample

use core::fmt::Display;
use debug_fn::debug_fn;

fn format_string(s: &str) -> impl Display + use<'_> {
    debug_fn(move |f| f.write_str(s))
}