wow cool $crate hack thank you nemo

This commit is contained in:
nora 2022-09-13 13:11:26 +02:00
parent 20befd0a8f
commit 5b22878e81
3 changed files with 49 additions and 29 deletions

View file

@ -50,17 +50,17 @@ impl Arguments for Str {
}
}
pub struct DebugArg<T>(pub T);
pub struct DebugArg<T, O>(pub T, pub PhantomData<O>);
impl<T: Debug> Arguments for DebugArg<T> {
impl<T: Debug, OutOpt> Arguments for DebugArg<T, OutOpt> {
fn fmt<W: Write, O: FmtOpts>(&self, f: &mut Formatter<W, O>) -> Result {
Debug::fmt(&self.0, f)
}
}
pub struct DisplayArg<T>(pub T);
pub struct DisplayArg<T, O>(pub T, pub PhantomData<O>);
impl<T: Display> Arguments for DisplayArg<T> {
impl<T: Display, OutOpt> Arguments for DisplayArg<T, OutOpt> {
fn fmt<W: Write, O: FmtOpts>(&self, f: &mut Formatter<W, O>) -> Result {
Display::fmt(&self.0, f)
}