mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-15 00:00:18 +02:00
Add clear method to RingBuf
This commit is contained in:
committed by
Carl Lerche
parent
4ce8b1c2c8
commit
a76dd8ed0e
@@ -91,6 +91,13 @@ impl RingBuf {
|
||||
}
|
||||
}
|
||||
|
||||
/// Resets all internal state to the initial state.
|
||||
pub fn clear(&mut self) {
|
||||
self.pos = 0;
|
||||
self.len = 0;
|
||||
self.mark = Mark::NoMark;
|
||||
}
|
||||
|
||||
/// Returns the number of bytes remaining to read.
|
||||
fn read_remaining(&self) -> usize {
|
||||
self.len
|
||||
|
||||
Reference in New Issue
Block a user