Skip to content

Commit 3765a52

Browse files
committed
fmt: add &mut dyn Write impl for jiff::fmt::Write
I was playing with using this to avoid parametric polymorphism costs, but I couldn't find my way to a concrete benefit. Either way, this impl should exist for people that want to use it.
1 parent 42080c4 commit 3765a52

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/fmt/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,17 @@ impl<W: Write> Write for &mut W {
334334
}
335335
}
336336

337+
impl Write for &mut dyn Write {
338+
fn write_str(&mut self, string: &str) -> Result<(), Error> {
339+
(**self).write_str(string)
340+
}
341+
342+
#[inline]
343+
fn write_char(&mut self, char: char) -> Result<(), Error> {
344+
(**self).write_char(char)
345+
}
346+
}
347+
337348
/// An adapter for using `std::io::Write` implementations with `fmt::Write`.
338349
///
339350
/// This is useful when one wants to format a datetime or span directly

0 commit comments

Comments
 (0)