mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-09 00:00:15 +02:00
13 lines
245 B
Rust
13 lines
245 B
Rust
use bytes::*;
|
|
use std::io::{Cursor, Read};
|
|
|
|
#[test]
|
|
pub fn test_take_from_buf() {
|
|
let mut buf = Take::new(Cursor::new(b"hello world".to_vec()), 5);
|
|
let mut res = vec![];
|
|
|
|
buf.read_to_end(&mut res);
|
|
|
|
assert_eq!(&res, b"hello");
|
|
}
|