1 unstable release

0.2.1 Jan 15, 2020

#28 in #peek

Download history 293/week @ 2024-09-01 226/week @ 2024-09-08 224/week @ 2024-09-15 297/week @ 2024-09-22 237/week @ 2024-09-29 43/week @ 2024-10-06 181/week @ 2024-10-13 182/week @ 2024-10-20 216/week @ 2024-10-27 200/week @ 2024-11-03 62/week @ 2024-11-10 122/week @ 2024-11-17 237/week @ 2024-11-24 221/week @ 2024-12-01 372/week @ 2024-12-08 350/week @ 2024-12-15

1,208 downloads per month
Used in peek-poke

MIT/Apache

12KB
216 lines

Peeks, Pokes, and Pointers

Peek from and poke structures into byte slices.

Benchmark

Below are the benchmark results of comparison between peek-poke and bincode serializing and deserializing same 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]

You can run benchmarks by running following command:

cargo bench

License

Licensed under either of

at your option.

see LICENSE-APACHE, LICENSE-MIT for details.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as about, without any additional terms or conditions.

Dependencies

~1.5MB
~40K SLoC