feat: add bytes

This commit is contained in:
2021-03-21 20:46:27 +08:00
parent 67f62ee869
commit dceda46ae8
3 changed files with 34 additions and 0 deletions

14
__misc/bytes/Cargo.lock generated Normal file
View File

@@ -0,0 +1,14 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "bytes"
version = "0.1.0"
dependencies = [
"bytes 1.0.1",
]
[[package]]
name = "bytes"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040"

11
__misc/bytes/Cargo.toml Normal file
View File

@@ -0,0 +1,11 @@
[package]
name = "bytes"
version = "0.1.0"
authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bytes = "1.0.1"

9
__misc/bytes/src/main.rs Normal file
View File

@@ -0,0 +1,9 @@
use bytes::{BytesMut, BufMut};
fn main() {
let mut buf = BytesMut::new();
buf.put_u8(0x20);
buf.put(&b"hello world"[..]);
println!("{:?}", buf);
}