Skip to main content

devela/data/codec/bin/bit/field/
_example.rs

1// devela/src/data/codec/bin/bit/field/_example.rs
2//
3//! Defines [`BitfieldExample`]
4//
5
6crate::bitfield! {
7    #[doc = crate::_tags!(example bit mem data_structure)]
8    /// A compact packet header.
9    #[doc = crate::_doc_meta!{
10        location("data/codec/bin", macro bitfield),
11        test_size_of(BitfieldExample = 2|16; niche !Option),
12    }]
13    /// It has been generated with the [`bitfield!`][crate::bitfield] macro like this:
14    /// ```
15    /// use devela::bitfield;
16    ///
17    /// bitfield! {
18    ///     /// A compact packet header.
19    ///     pub struct BitfieldExample(u16) {
20    ///         KIND    = 0..=3;
21    ///         VERSION = 4..=7;
22    ///         LENGTH  = 8..=15;
23    ///     }
24    /// }
25    /// ```
26    pub struct BitfieldExample(u16) {
27        KIND    = 0..=3;
28        VERSION = 4..=7;
29        LENGTH  = 8..=15;
30    }
31}