mirror of https://git.sr.ht/~stygianentity/bincode
Add reference implementation for Writer and remove unnecessary lifetimes from Reader's one (#507)
This commit is contained in:
parent
7c72e4c1fa
commit
1c5041390f
|
|
@ -31,7 +31,7 @@ pub trait Reader {
|
|||
fn consume(&mut self, _: usize) {}
|
||||
}
|
||||
|
||||
impl<'a, T> Reader for &'a mut T
|
||||
impl<T> Reader for &mut T
|
||||
where
|
||||
T: Reader,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,6 +12,13 @@ pub trait Writer {
|
|||
fn write(&mut self, bytes: &[u8]) -> Result<(), EncodeError>;
|
||||
}
|
||||
|
||||
impl<T: Writer> Writer for &mut T {
|
||||
#[inline]
|
||||
fn write(&mut self, bytes: &[u8]) -> Result<(), EncodeError> {
|
||||
(**self).write(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
/// A helper struct that implements `Writer` for a `&[u8]` slice.
|
||||
///
|
||||
/// ```
|
||||
|
|
|
|||
Loading…
Reference in New Issue