chore: reorg

This commit is contained in:
2020-10-17 12:01:53 +08:00
parent 0e7cc78585
commit bf1a0343cc
32 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
use bytes::{Bytes, BytesMut, Buf, BufMut};
fn main() {
println!("Run #test_bytes()");
test_bytes();
println!("Run #test_bytes_mut()");
test_bytes_mut();
}
fn test_bytes() {
let mut buf = Bytes::from(&b"1122334455"[..]);
let v1 = buf.get_u16();
let v2 = buf.get_u16();
println!("v1: {}, v2: {}", v1, v2);
}
fn test_bytes_mut() {
let mut buf = BytesMut::with_capacity(2);
println!("[{}], len: {}", hex::encode(buf.bytes()), buf.len());
buf.put_u64(112233445566778899);
println!("[{}], len: {}", hex::encode(buf.bytes()), buf.len());
buf.put_u16(1);
println!("[{}], len: {}", hex::encode(buf.bytes()), buf.len());
}