feat: update bytes
This commit is contained in:
@@ -3,7 +3,16 @@ use bytes::{BytesMut, BufMut};
|
||||
fn main() {
|
||||
let mut buf = BytesMut::new();
|
||||
buf.put_u8(0x20);
|
||||
buf.put_u16(0x1234);
|
||||
buf.put_u8(0x20);
|
||||
buf.put_u16_le(0x1234);
|
||||
buf.put(&b"hello world"[..]);
|
||||
|
||||
println!("{:?}", buf);
|
||||
println!("{:?}", &buf);
|
||||
println!("{:x?}", &buf[..]);
|
||||
|
||||
let mut buf2 = BytesMut::with_capacity(8);
|
||||
println!("{:x?}", &buf2[..]);
|
||||
buf2.resize(8, 0x00);
|
||||
println!("{:x?}", &buf2[..]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user