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
This commit is contained in:
Tobin C. Harding 2025-01-06 16:11:16 +11:00
parent 72aceb32db
commit 6cf90132bc
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 2 additions and 2 deletions

View File

@ -192,7 +192,7 @@ impl BufRead for &[u8] {
} }
/// Wraps an in memory reader providing the `position` function. /// Wraps an in memory reader providing the `position` function.
#[derive(Debug)] #[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct Cursor<T> { pub struct Cursor<T> {
inner: T, inner: T,
pos: u64, 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. /// A sink to which all writes succeed. See [`std::io::Sink`] for more info.
/// ///
/// Created using `io::sink()`. /// Created using `io::sink()`.
#[derive(Debug)] #[derive(Clone, Copy, Debug, Default)]
pub struct Sink; pub struct Sink;
impl Write for Sink { impl Write for Sink {