bitfield 0.0.11

A procedural macro to generate bitfield-like stuct
docs.rs failed to build bitfield-0.0.11
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: bitfield-0.15.0

rust-bitfield

Build Status

This project provides a procedural macro to generate bitfield-like struct.

The generated structs use an array of u8 for the data and provide methods to get and set the values of the fields.

The generatated structs are not compatible with C bitfield. Unlike in C, the position of each bytes and bits in the underling bytes array is specifed. The bytes are in network order, and the bits are MSB first. No padding is added.

Because the generated struct is just a normal struct, you can add other methods to it or implement the trait you want.

Possible use includes decoding some binary file formats and reading the headers of some network protocols or some low-level protocols.

Usage

To use this macro in a cargo enabled project, add the following to your Cargo.toml:

[dependencies.bitfield]
git = "https://github.com/dzamlo/rust-bitfield"

See the examples folder for examples of the use the macro.

License

Licensed under either of

at your option.

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 above, without any additional terms or conditions.