proc_bitfield/
lib.rs

1#![doc = include_str!("../docs.md")]
2#![cfg_attr(not(test), no_std)]
3#![cfg_attr(all(doc, feature = "nightly"), feature(doc_cfg))]
4#![cfg_attr(all(any(doc, test), feature = "nightly"), feature(trivial_bounds))]
5#![warn(clippy::all)]
6
7#[doc(hidden)]
8pub mod __private {
9    pub use static_assertions;
10}
11
12/// The main focus of the crate. Defines a bitfield struct.
13#[doc = include_str!("../usage_examples/bitfield.md")]
14pub use macros::bitfield;
15
16/// Reads a single field from an anonymous bitfield, without creating a bitfield struct.
17#[doc = include_str!("../usage_examples/bits.md")]
18pub use macros::bits;
19
20/// Returns an anonymous bitfield with a single field modified, without creating a bitfield struct.
21#[doc = include_str!("../usage_examples/with_bits.md")]
22pub use macros::with_bits;
23
24/// Modifies a single field in an anonymous bitfield, without creating a bitfield struct.
25#[doc = include_str!("../usage_examples/set_bits.md")]
26pub use macros::set_bits;
27
28/// A derive macro to implement any applicable conversion traits between an enum and the builtin
29/// integer and boolean types corresponding to variant discriminants.
30#[doc = include_str!("../usage_examples/conv_raw.md")]
31pub use macros::ConvRaw;
32
33#[cfg(feature = "nightly")]
34#[cfg_attr(all(doc, feature = "nightly"), doc(cfg(feature = "nightly")))]
35/// A derive macro to implement `Bits<T> for U` and the related traits for a type `T` and all
36/// integer bitfield storage types `U`, by unwrapping the conversion results.
37#[doc = include_str!("../usage_examples/unwrap_bits.md")]
38pub use macros::UnwrapBits;
39
40mod conv;
41pub use conv::*;
42mod traits;
43pub use traits::*;
44pub mod nested;
45
46#[cfg(any(test, doc))]
47extern crate self as proc_bitfield;
48
49#[cfg(doc)]
50/// Sample bitfields to showcase the crate's features
51pub mod example;