mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-18 00:00:12 +02:00
Add bytes() method to MutByteBuf to allow reading of data already written
without necessitating flipping to ByteBuf.
This commit is contained in:
@@ -303,6 +303,10 @@ impl MutByteBuf {
|
||||
len as usize
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bytes<'a>(&'a self) -> &'a [u8] {
|
||||
&self.buf.mem.bytes()[..self.buf.pos()]
|
||||
}
|
||||
}
|
||||
|
||||
impl MutBuf for MutByteBuf {
|
||||
|
||||
Reference in New Issue
Block a user