Skip to content

Commit

Permalink
Implement Debug for FormatWith, same as Display
Browse files Browse the repository at this point in the history
The type `std::fmt::Arguments` (returned by `format_args!`) similarly delegates `Debug` to `Display`.
  • Loading branch information
Philippe-Cholet committed May 7, 2024
1 parent 0f3cbcc commit 0fcc6d1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ where
}
}

impl<'a, I, F> fmt::Debug for FormatWith<'a, I, F>
where
I: Iterator,
F: FnMut(I::Item, &mut dyn FnMut(&dyn fmt::Display) -> fmt::Result) -> fmt::Result,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self, f)
}
}

impl<'a, I> Format<'a, I>
where
I: Iterator,
Expand Down

0 comments on commit 0fcc6d1

Please sign in to comment.