From 0fcc6d190f16601352e901173fd429eccbe9556b Mon Sep 17 00:00:00 2001 From: Philippe-Cholet <44676486+Philippe-Cholet@users.noreply.github.com> Date: Fri, 3 May 2024 14:52:35 +0200 Subject: [PATCH] Implement `Debug` for `FormatWith`, same as `Display` The type `std::fmt::Arguments` (returned by `format_args!`) similarly delegates `Debug` to `Display`. --- src/format.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/format.rs b/src/format.rs index c4cb65dcb..83382c5a5 100644 --- a/src/format.rs +++ b/src/format.rs @@ -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,