mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-15 00:00:18 +02:00
add mark/reset feature to ByteBuf and RingBuf
This commit is contained in:
@@ -30,6 +30,10 @@ pub fn test_byte_buf_read_write() {
|
||||
let mut buf = buf.flip();
|
||||
let mut dst = [0; 5];
|
||||
|
||||
buf.mark();
|
||||
assert_eq!(5, buf.read(&mut dst[..]).unwrap());
|
||||
assert_eq!(b"hello", &dst);
|
||||
buf.reset();
|
||||
assert_eq!(5, buf.read(&mut dst[..]).unwrap());
|
||||
assert_eq!(b"hello", &dst);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user