11 releases

0.3.0 Feb 27, 2020
0.2.8 Aug 8, 2019
0.2.7 Jul 25, 2019
0.2.5 Jun 28, 2019
0.0.0 Aug 15, 2018
Download history 3717/week @ 2020-11-06 3501/week @ 2020-11-13 3828/week @ 2020-11-20 4582/week @ 2020-11-27 6543/week @ 2020-12-04 6697/week @ 2020-12-11 5528/week @ 2020-12-18 4383/week @ 2020-12-25 7854/week @ 2021-01-01 9189/week @ 2021-01-08 7782/week @ 2021-01-15 9867/week @ 2021-01-22 8221/week @ 2021-01-29 8458/week @ 2021-02-05 7423/week @ 2021-02-12 6618/week @ 2021-02-19

15,151 downloads per month
Used in 88 crates (42 directly)

BSD-3-Clause

130KB
1.5K SLoC


lib.rs:

Utilities for safe zero-copy parsing and serialization.

This crate provides utilities which make it easy to perform zero-copy parsing and serialization by allowing zero-copy conversion to/from byte slices.

This is enabled by three core marker traits, each of which can be derived (e.g., #[derive(FromBytes)]):

  • [FromBytes] indicates that a type may safely be converted from an arbitrary byte sequence
  • [AsBytes] indicates that a type may safely be converted to a byte sequence
  • [Unaligned] indicates that a type's alignment requirement is 1

Types which implement a subset of these traits can then be converted to/from byte sequences with little to no runtime overhead.

Note that these traits are ignorant of byte order. For byte order-aware types, see the [byteorder] module.

Dependencies

~0.5–1MB
~23K SLoC