aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / bitflags / src / example_generated.rs
| 1 | //! This module shows an example of code generated by the macro. **IT MUST NOT BE USED OUTSIDE THIS |
| 2 | //! CRATE**. |
| 3 | //! |
| 4 | //! Usually, when you call the `bitflags!` macro, only the `Flags` type would be visible. In this |
| 5 | //! example, the `Field0`, `Iter`, and `IterRaw` types are also exposed so that you can explore |
| 6 | //! their APIs. The `Field0` type can be accessed as `self.0` on an instance of `Flags`. |
| 7 | |
| 8 | __declare_public_bitflags! { |
| 9 | /// This is the same `Flags` struct defined in the [crate level example](../index.html#example). |
| 10 | /// Note that this struct is just for documentation purposes only, it must not be used outside |
| 11 | /// this crate. |
| 12 | pub struct Flags |
| 13 | } |
| 14 | |
| 15 | __declare_internal_bitflags! { |
| 16 | pub struct Field0: u32 |
| 17 | } |
| 18 | |
| 19 | __impl_internal_bitflags! { |
| 20 | Field0: u32, Flags { |
| 21 | /// Field `A`. |
| 22 | /// |
| 23 | /// This flag has the value `0b00000001`. |
| 24 | const A = 0b00000001; |
| 25 | /// Field `B`. |
| 26 | /// |
| 27 | /// This flag has the value `0b00000010`. |
| 28 | const B = 0b00000010; |
| 29 | /// Field `C`. |
| 30 | /// |
| 31 | /// This flag has the value `0b00000100`. |
| 32 | const C = 0b00000100; |
| 33 | const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits(); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | __impl_public_bitflags_forward! { |
| 38 | Flags: u32, Field0 |
| 39 | } |
| 40 | |
| 41 | __impl_public_bitflags_ops! { |
| 42 | Flags |
| 43 | } |
| 44 | |
| 45 | __impl_public_bitflags_iter! { |
| 46 | Flags: u32, Flags |
| 47 | } |
| 48 | |
| 49 | __impl_public_bitflags_consts! { |
| 50 | Flags: u32 { |
| 51 | /// Field `A`. |
| 52 | /// |
| 53 | /// This flag has the value `0b00000001`. |
| 54 | const A = 0b00000001; |
| 55 | /// Field `B`. |
| 56 | /// |
| 57 | /// This flag has the value `0b00000010`. |
| 58 | const B = 0b00000010; |
| 59 | /// Field `C`. |
| 60 | /// |
| 61 | /// This flag has the value `0b00000100`. |
| 62 | const C = 0b00000100; |
| 63 | const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits(); |
| 64 | } |
| 65 | } |