autocommit 2022-01-28 03:35:35 CET
This commit is contained in:
parent
c340df0d08
commit
a5573b8a3a
36 changed files with 3046 additions and 114 deletions
21
src/utils/debug_fn.rs
Normal file
21
src/utils/debug_fn.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
use std::fmt::{Debug, Formatter};
|
||||
|
||||
pub fn debug_fn<F>(f: F) -> impl Debug
|
||||
where
|
||||
F: Fn(&mut Formatter<'_>) -> std::fmt::Result,
|
||||
{
|
||||
DebugFn { f }
|
||||
}
|
||||
|
||||
struct DebugFn<F> {
|
||||
f: F,
|
||||
}
|
||||
|
||||
impl<F> Debug for DebugFn<F>
|
||||
where
|
||||
F: Fn(&mut Formatter<'_>) -> std::fmt::Result,
|
||||
{
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
(self.f)(f)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue