Implement IntoFormat for &T (#4781)

This commit is contained in:
Micha Reiser
2023-06-01 12:20:49 +02:00
committed by GitHub
parent 4ea4fd1984
commit 5f4bce6d2b

View File

@@ -44,6 +44,18 @@ where
}
}
/// Implement [`IntoFormat`] for references to types that implement [`AsFormat`].
impl<'a, T, C> IntoFormat<C> for &'a T
where
T: AsFormat<C>,
{
type Format = T::Format<'a>;
fn into_format(self) -> Self::Format {
AsFormat::format(self)
}
}
/// Formatting specific [`Iterator`] extensions
pub trait FormattedIterExt {
/// Converts every item to an object that knows how to format it.