随笔分类 - Bytes
摘要:环境 Time 2022-05-29 Rust 1.61.0 Bytes 1.1.0 前言 说明 参考:https://docs.rs/bytes/latest/bytes/trait.BufMut.html 目标 使用 BufMut 的方法。 remaining_mut fn main() { l
阅读全文
摘要:环境 Time 2022-05-29 Rust 1.61.0 Bytes 1.1.0 前言 说明 参考:https://docs.rs/bytes/latest/bytes/struct.BytesMut.html 目标 使用 BytesMut 的方法。 with_capacity fn main(
阅读全文
摘要:环境 Time 2022-05-29 Rust 1.61.0 Bytes 1.1.0 前言 说明 参考:https://docs.rs/bytes/latest/bytes/trait.Buf.html 目标 Bytes 实现了 Buf,使用一下其中的方法。 remaining fn main()
阅读全文
摘要:环境 Time 2022-05-29 Rust 1.61.0 Bytes 1.1.0 前言 说明 参考:https://docs.rs/bytes/latest/bytes/struct.Bytes.html 目标 Bytes 的源码基本上看完了,简单使用一下其中的方法。 new fn main()
阅读全文
摘要:环境 Time 2022-05-29 Rust 1.61.0 Bytes 1.1.0 前言 说明 参考:https://github.com/tokio-rs/bytes 目标 Buf 是一个 trait,里面有几个方法需要实现,Bytes 实现了 Buf。 remaining fn remaini
阅读全文
摘要:环境 Time 2022-05-29 Rust 1.61.0 Bytes 1.1.0 前言 说明 参考:https://github.com/tokio-rs/bytes 目标 Bytes 实现迭代器。 IntoIter #[derive(Debug)] pub struct IntoIter<T>
阅读全文
摘要:环境 Time 2022-05-29 Rust 1.61.0 Bytes 1.1.0 前言 说明 参考: https://github.com/tokio-rs/bytes https://zhuanlan.zhihu.com/p/109977513 目标 之前阅读的部分,都是关于静态的字节,后面开
阅读全文
摘要:环境 Time 2022-05-29 Rust 1.61.0 Bytes 1.1.0 前言 说明 参考: https://github.com/tokio-rs/bytes https://zhuanlan.zhihu.com/p/109977513 目标 之前阅读的部分,都是关于静态的字节,后面开
阅读全文
摘要:环境 Time 2022-05-29 Rust 1.61.0 Bytes 1.1.0 前言 说明 参考: https://github.com/tokio-rs/bytes https://zhuanlan.zhihu.com/p/109977513 目标 之前阅读的部分,都是关于静态的字节,后面开
阅读全文
摘要:环境 Time 2022-05-28 Rust 1.61.0 Bytes 1.1.0 前言 说明 参考:https://github.com/tokio-rs/bytes 目标 实现 bytes.rs 中的一部分方法。 线程安全 实现了两个线程安全的标记接口。 unsafe impl Send fo
阅读全文
摘要:环境 Time 2022-05-28 Rust 1.61.0 Bytes 1.1.0 前言 说明 参考:https://github.com/tokio-rs/bytes 目标 实现 bytes.rs 中的一部分方法。 split_off 在中间进行切割,分成两半。 pub fn split_off
阅读全文
摘要:环境 Time 2022-05-28 Rust 1.61.0 Bytes 1.1.0 前言 说明 参考:https://github.com/tokio-rs/bytes 目标 实现 bytes.rs 中的一部分方法。 Deref 通过实现 Deref 来实现自动解引用,解引用成字节切片。 impl
阅读全文
摘要:环境 Time 2022-05-28 Rust 1.61.0 Bytes 1.1.0 前言 说明 参考:https://github.com/tokio-rs/bytes 目标 实现 bytes.rs 中的一部分方法。 Drop 通过自定义的 Vtable 来实现 drop 方法。 impl Dro
阅读全文
摘要:环境 Time 2022-05-28 Rust 1.61.0 Bytes 1.1.0 前言 说明 参考:https://github.com/tokio-rs/bytes 目标 了解从静态生命周期的字节中创建 bytes.rs,以及实现一部分方法。 from_static 根据一个静态生命周期的字节
阅读全文
摘要:环境 Time 2022-05-27 Rust 1.61.0 Bytes 1.1.0 前言 说明 参考:https://github.com/tokio-rs/bytes 目标 了解 bytes.rs 中 Bytes 的结构定义。 lib.rs 首先将 bytes.rs 引入到 lib.rs 中,然
阅读全文