From 6cf90132bce0d54a0d78e0b27939b20599264770 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Mon, 6 Jan 2025 16:11:16 +1100 Subject: [PATCH] io: Add traits So that our `io` crate is not surprising it seems we should generally, unless there is a good reason not to, follow `std::io`. Copy the derived trait implementations from `std::io` for `Cursor`, `Sink`, and `Take`. Done while investigating C-COMMON-TRAITS --- io/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/io/src/lib.rs b/io/src/lib.rs index c8d846dd5..5f747b289 100644 --- a/io/src/lib.rs +++ b/io/src/lib.rs @@ -192,7 +192,7 @@ impl BufRead for &[u8] { } /// Wraps an in memory reader providing the `position` function. -#[derive(Debug)] +#[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct Cursor { inner: T, pos: u64, @@ -331,7 +331,7 @@ impl Write for &mut [u8] { /// A sink to which all writes succeed. See [`std::io::Sink`] for more info. /// /// Created using `io::sink()`. -#[derive(Debug)] +#[derive(Clone, Copy, Debug, Default)] pub struct Sink; impl Write for Sink {