1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// One downside of the way we have implemented enum support so far is that it
// makes it impossible to see from the definition of a bitfield struct how the
// bits are being laid out. In something like the following bitfield, all we
// know from this code is that the total size is a multiple of 8 bits. Maybe
// trigger_mode is 11 bits and delivery_mode is 1 bit. This may tend to make
// maintenance problematic when the types involved are defined across different
// modules or even different crates.
//
// #[bitfield]
// pub struct RedirectionTableEntry {
// trigger_mode: TriggerMode,
// delivery_mode: DeliveryMode,
// reserved: B4,
// }
//
// Introduce an optional #[bits = N] attribute to serve as compile-time checked
// documentation of field size. Ensure that this attribute is entirely optional,
// meaning that the code behaves the same whether or not you write it, but if
// the user does provide the attribute then the program must not compile if
// their value is wrong.
use *;