1 个不稳定版本

0.2.1 2020年1月15日

#29 in #peek

Download history 241/week @ 2024-03-13 323/week @ 2024-03-20 323/week @ 2024-03-27 328/week @ 2024-04-03 295/week @ 2024-04-10 307/week @ 2024-04-17 294/week @ 2024-04-24 262/week @ 2024-05-01 261/week @ 2024-05-08 282/week @ 2024-05-15 268/week @ 2024-05-22 386/week @ 2024-05-29 245/week @ 2024-06-05 192/week @ 2024-06-12 238/week @ 2024-06-19 207/week @ 2024-06-26

919 每月下载量
peek-poke 中使用

MIT/Apache

12KB
216 代码行

窥视、戳击和指针

从字节切片中窥视并戳击结构。

基准测试

以下是peek-poke与bincode序列化和反序列化相同struct的基准测试结果。

struct MyPeekPokeStruct {
    a: u8,
    b: u16,
    c: MyPeekPokeEnum,
    d: Option<usize>,
}

enum MyPeekPokeEnum {
    Variant1,
    Variant2(u16),
}
Benchmarking struct::serialize/peek_poke::poke_into: Collecting 100 samples in                                                                                struct::serialize/peek_poke::poke_into
                        time:   [2.7267 ns 2.7321 ns 2.7380 ns]

Benchmarking struct::serialize/bincode::serialize: Collecting 100 samples in est                                                                                struct::serialize/bincode::serialize
                        time:   [31.264 ns 31.326 ns 31.389 ns]

Benchmarking struct::deserialize/peek_poke::peek_from: Collecting 100 samples                                                                                 struct::deserialize/peek_poke::peek_from
                        time:   [5.3544 ns 5.3672 ns 5.3817 ns]

Benchmarking struct::deserialize/bincode::deserialize: Collecting 100 samples in                                                                                struct::deserialize/bincode::deserialize
                        time:   [25.155 ns 26.439 ns 27.661 ns]

您可以通过运行以下命令来运行基准测试:

cargo bench

许可证

许可协议为以下之一:

任选其一。

有关详细信息,请参阅LICENSE-APACHELICENSE-MIT

贡献

除非您明确声明,否则根据Apache-2.0许可证定义的任何有意提交以包含在作品中的贡献,均将作为约,双重许可,没有任何附加条款或条件。

依赖项

~1.5MB
~37K SLoC