feat: add bytes
This commit is contained in:
14
__misc/bytes/Cargo.lock
generated
Normal file
14
__misc/bytes/Cargo.lock
generated
Normal 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
11
__misc/bytes/Cargo.toml
Normal 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
9
__misc/bytes/src/main.rs
Normal 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);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user