mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-08 00:00:26 +02:00
18 lines
319 B
Rust
18 lines
319 B
Rust
extern crate bytes;
|
|
|
|
use bytes::{Buf, IntoBuf, Bytes};
|
|
|
|
pub fn dump<T>(data: &T) where
|
|
for<'a> &'a T: IntoBuf,
|
|
{
|
|
let mut dst: Vec<u8> = vec![];
|
|
data.into_buf().copy_to(&mut dst);
|
|
println!("GOT: {:?}", dst);
|
|
}
|
|
|
|
pub fn main() {
|
|
let b = Bytes::from_slice(b"hello world");
|
|
dump(&b);
|
|
dump(&b);
|
|
}
|