Made `peek_read` take `&mut self` (#572)
This commit is contained in:
parent
922aba4b7a
commit
88ab23f544
|
|
@ -21,7 +21,7 @@ pub trait Reader {
|
||||||
/// If this reader wraps a buffer of any kind, this function lets callers access contents of
|
/// If this reader wraps a buffer of any kind, this function lets callers access contents of
|
||||||
/// the buffer without passing data through a buffer first.
|
/// the buffer without passing data through a buffer first.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn peek_read(&self, _: usize) -> Option<&[u8]> {
|
fn peek_read(&mut self, _: usize) -> Option<&[u8]> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn peek_read(&self, n: usize) -> Option<&[u8]> {
|
fn peek_read(&mut self, n: usize) -> Option<&[u8]> {
|
||||||
(**self).peek_read(n)
|
(**self).peek_read(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ impl<'storage> Reader for SliceReader<'storage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn peek_read(&self, n: usize) -> Option<&'storage [u8]> {
|
fn peek_read(&mut self, n: usize) -> Option<&'storage [u8]> {
|
||||||
self.slice.get(..n)
|
self.slice.get(..n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn peek_read(&self, n: usize) -> Option<&[u8]> {
|
fn peek_read(&mut self, n: usize) -> Option<&[u8]> {
|
||||||
self.buffer().get(..n)
|
self.buffer().get(..n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue