Coverage Report

Created: 2024-11-30 06:06

/rust/registry/src/index.crates.io-6f17d22bba15001f/bitflags-2.6.0/src/lib.rs
Line
Count
Source (jump to first uncovered line)
1
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2
// file at the top-level directory of this distribution and at
3
// http://rust-lang.org/COPYRIGHT.
4
//
5
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
// option. This file may not be copied, modified, or distributed
9
// except according to those terms.
10
11
/*!
12
Generate types for C-style flags with ergonomic APIs.
13
14
# Getting started
15
16
Add `bitflags` to your `Cargo.toml`:
17
18
```toml
19
[dependencies.bitflags]
20
version = "2.6.0"
21
```
22
23
## Generating flags types
24
25
Use the [`bitflags`] macro to generate flags types:
26
27
```rust
28
use bitflags::bitflags;
29
30
bitflags! {
31
    pub struct Flags: u32 {
32
        const A = 0b00000001;
33
        const B = 0b00000010;
34
        const C = 0b00000100;
35
    }
36
}
37
```
38
39
See the docs for the `bitflags` macro for the full syntax.
40
41
Also see the [`example_generated`](./example_generated/index.html) module for an example of what the `bitflags` macro generates for a flags type.
42
43
### Externally defined flags
44
45
If you're generating flags types for an external source, such as a C API, you can define
46
an extra unnamed flag as a mask of all bits the external source may ever set. Usually this would be all bits (`!0`):
47
48
```rust
49
# use bitflags::bitflags;
50
bitflags! {
51
    pub struct Flags: u32 {
52
        const A = 0b00000001;
53
        const B = 0b00000010;
54
        const C = 0b00000100;
55
56
        // The source may set any bits
57
        const _ = !0;
58
    }
59
}
60
```
61
62
Why should you do this? Generated methods like `all` and truncating operators like `!` only consider
63
bits in defined flags. Adding an unnamed flag makes those methods consider additional bits,
64
without generating additional constants for them. It helps compatibility when the external source
65
may start setting additional bits at any time. The [known and unknown bits](#known-and-unknown-bits)
66
section has more details on this behavior.
67
68
### Custom derives
69
70
You can derive some traits on generated flags types if you enable Cargo features. The following
71
libraries are currently supported:
72
73
- `serde`: Support `#[derive(Serialize, Deserialize)]`, using text for human-readable formats,
74
and a raw number for binary formats.
75
- `arbitrary`: Support `#[derive(Arbitrary)]`, only generating flags values with known bits.
76
- `bytemuck`: Support `#[derive(Pod, Zeroable)]`, for casting between flags values and their
77
underlying bits values.
78
79
You can also define your own flags type outside of the [`bitflags`] macro and then use it to generate methods.
80
This can be useful if you need a custom `#[derive]` attribute for a library that `bitflags` doesn't
81
natively support:
82
83
```rust
84
# use std::fmt::Debug as SomeTrait;
85
# use bitflags::bitflags;
86
#[derive(SomeTrait)]
87
pub struct Flags(u32);
88
89
bitflags! {
90
    impl Flags: u32 {
91
        const A = 0b00000001;
92
        const B = 0b00000010;
93
        const C = 0b00000100;
94
    }
95
}
96
```
97
98
### Adding custom methods
99
100
The [`bitflags`] macro supports attributes on generated flags types within the macro itself, while
101
`impl` blocks can be added outside of it:
102
103
```rust
104
# use bitflags::bitflags;
105
bitflags! {
106
    // Attributes can be applied to flags types
107
    #[repr(transparent)]
108
    #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
109
    pub struct Flags: u32 {
110
        const A = 0b00000001;
111
        const B = 0b00000010;
112
        const C = 0b00000100;
113
    }
114
}
115
116
// Impl blocks can be added to flags types
117
impl Flags {
118
    pub fn as_u64(&self) -> u64 {
119
        self.bits() as u64
120
    }
121
}
122
```
123
124
## Working with flags values
125
126
Use generated constants and standard bitwise operators to interact with flags values:
127
128
```rust
129
# use bitflags::bitflags;
130
# bitflags! {
131
#     #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
132
#     pub struct Flags: u32 {
133
#         const A = 0b00000001;
134
#         const B = 0b00000010;
135
#         const C = 0b00000100;
136
#     }
137
# }
138
// union
139
let ab = Flags::A | Flags::B;
140
141
// intersection
142
let a = ab & Flags::A;
143
144
// difference
145
let b = ab - Flags::A;
146
147
// complement
148
let c = !ab;
149
```
150
151
See the docs for the [`Flags`] trait for more details on operators and how they behave.
152
153
# Formatting and parsing
154
155
`bitflags` defines a text format that can be used to convert any flags value to and from strings.
156
157
See the [`parser`] module for more details.
158
159
# Specification
160
161
The terminology and behavior of generated flags types is
162
[specified in the source repository](https://github.com/bitflags/bitflags/blob/main/spec.md).
163
Details are repeated in these docs where appropriate, but is exhaustively listed in the spec. Some
164
things are worth calling out explicitly here.
165
166
## Flags types, flags values, flags
167
168
The spec and these docs use consistent terminology to refer to things in the bitflags domain:
169
170
- **Bits type**: A type that defines a fixed number of bits at specific locations.
171
- **Flag**: A set of bits in a bits type that may have a unique name.
172
- **Flags type**: A set of defined flags over a specific bits type.
173
- **Flags value**: An instance of a flags type using its specific bits value for storage.
174
175
```
176
# use bitflags::bitflags;
177
bitflags! {
178
    struct FlagsType: u8 {
179
//                    -- Bits type
180
//         --------- Flags type
181
        const A = 1;
182
//            ----- Flag
183
    }
184
}
185
186
let flag = FlagsType::A;
187
//  ---- Flags value
188
```
189
190
## Known and unknown bits
191
192
Any bits in a flag you define are called _known bits_. Any other bits are _unknown bits_.
193
In the following flags type:
194
195
```
196
# use bitflags::bitflags;
197
bitflags! {
198
    struct Flags: u8 {
199
        const A = 1;
200
        const B = 1 << 1;
201
        const C = 1 << 2;
202
    }
203
}
204
```
205
206
The known bits are `0b0000_0111` and the unknown bits are `0b1111_1000`.
207
208
`bitflags` doesn't guarantee that a flags value will only ever have known bits set, but some operators
209
will unset any unknown bits they encounter. In a future version of `bitflags`, all operators will
210
unset unknown bits.
211
212
If you're using `bitflags` for flags types defined externally, such as from C, you probably want all
213
bits to be considered known, in case that external source changes. You can do this using an unnamed
214
flag, as described in [externally defined flags](#externally-defined-flags).
215
216
## Zero-bit flags
217
218
Flags with no bits set should be avoided because they interact strangely with [`Flags::contains`]
219
and [`Flags::intersects`]. A zero-bit flag is always contained, but is never intersected. The
220
names of zero-bit flags can be parsed, but are never formatted.
221
222
## Multi-bit flags
223
224
Flags that set multiple bits should be avoided unless each bit is also in a single-bit flag.
225
Take the following flags type as an example:
226
227
```
228
# use bitflags::bitflags;
229
bitflags! {
230
    struct Flags: u8 {
231
        const A = 1;
232
        const B = 1 | 1 << 1;
233
    }
234
}
235
```
236
237
The result of `Flags::A ^ Flags::B` is `0b0000_0010`, which doesn't correspond to either
238
`Flags::A` or `Flags::B` even though it's still a known bit.
239
*/
240
241
#![cfg_attr(not(any(feature = "std", test)), no_std)]
242
#![cfg_attr(not(test), forbid(unsafe_code))]
243
#![cfg_attr(test, allow(mixed_script_confusables))]
244
245
#[doc(inline)]
246
pub use traits::{Bits, Flag, Flags};
247
248
pub mod iter;
249
pub mod parser;
250
251
mod traits;
252
253
#[doc(hidden)]
254
pub mod __private {
255
    #[allow(unused_imports)]
256
    // Easier than conditionally checking any optional external dependencies
257
    pub use crate::{external::__private::*, traits::__private::*};
258
259
    pub use core;
260
}
261
262
#[allow(unused_imports)]
263
pub use external::*;
264
265
#[allow(deprecated)]
266
pub use traits::BitFlags;
267
268
/*
269
How does the bitflags crate work?
270
271
This library generates a `struct` in the end-user's crate with a bunch of constants on it that represent flags.
272
The difference between `bitflags` and a lot of other libraries is that we don't actually control the generated `struct` in the end.
273
It's part of the end-user's crate, so it belongs to them. That makes it difficult to extend `bitflags` with new functionality
274
because we could end up breaking valid code that was already written.
275
276
Our solution is to split the type we generate into two: the public struct owned by the end-user, and an internal struct owned by `bitflags` (us).
277
To give you an example, let's say we had a crate that called `bitflags!`:
278
279
```rust
280
bitflags! {
281
    pub struct MyFlags: u32 {
282
        const A = 1;
283
        const B = 2;
284
    }
285
}
286
```
287
288
What they'd end up with looks something like this:
289
290
```rust
291
pub struct MyFlags(<MyFlags as PublicFlags>::InternalBitFlags);
292
293
const _: () = {
294
    #[repr(transparent)]
295
    #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
296
    pub struct MyInternalBitFlags {
297
        bits: u32,
298
    }
299
300
    impl PublicFlags for MyFlags {
301
        type Internal = InternalBitFlags;
302
    }
303
};
304
```
305
306
If we want to expose something like a new trait impl for generated flags types, we add it to our generated `MyInternalBitFlags`,
307
and let `#[derive]` on `MyFlags` pick up that implementation, if an end-user chooses to add one.
308
309
The public API is generated in the `__impl_public_flags!` macro, and the internal API is generated in
310
the `__impl_internal_flags!` macro.
311
312
The macros are split into 3 modules:
313
314
- `public`: where the user-facing flags types are generated.
315
- `internal`: where the `bitflags`-facing flags types are generated.
316
- `external`: where external library traits are implemented conditionally.
317
*/
318
319
/**
320
Generate a flags type.
321
322
# `struct` mode
323
324
A declaration that begins with `$vis struct` will generate a `struct` for a flags type, along with
325
methods and trait implementations for it. The body of the declaration defines flags as constants,
326
where each constant is a flags value of the generated flags type.
327
328
## Examples
329
330
Generate a flags type using `u8` as the bits type:
331
332
```
333
# use bitflags::bitflags;
334
bitflags! {
335
    struct Flags: u8 {
336
        const A = 1;
337
        const B = 1 << 1;
338
        const C = 0b0000_0100;
339
    }
340
}
341
```
342
343
Flags types are private by default and accept standard visibility modifiers. Flags themselves
344
are always public:
345
346
```
347
# use bitflags::bitflags;
348
bitflags! {
349
    pub struct Flags: u8 {
350
        // Constants are always `pub`
351
        const A = 1;
352
    }
353
}
354
```
355
356
Flags may refer to other flags using their [`Flags::bits`] value:
357
358
```
359
# use bitflags::bitflags;
360
bitflags! {
361
    struct Flags: u8 {
362
        const A = 1;
363
        const B = 1 << 1;
364
        const AB = Flags::A.bits() | Flags::B.bits();
365
    }
366
}
367
```
368
369
A single `bitflags` invocation may include zero or more flags type declarations:
370
371
```
372
# use bitflags::bitflags;
373
bitflags! {}
374
375
bitflags! {
376
    struct Flags1: u8 {
377
        const A = 1;
378
    }
379
380
    struct Flags2: u8 {
381
        const A = 1;
382
    }
383
}
384
```
385
386
# `impl` mode
387
388
A declaration that begins with `impl` will only generate methods and trait implementations for the
389
`struct` defined outside of the `bitflags` macro.
390
391
The struct itself must be a newtype using the bits type as its field.
392
393
The syntax for `impl` mode is identical to `struct` mode besides the starting token.
394
395
## Examples
396
397
Implement flags methods and traits for a custom flags type using `u8` as its underlying bits type:
398
399
```
400
# use bitflags::bitflags;
401
struct Flags(u8);
402
403
bitflags! {
404
    impl Flags: u8 {
405
        const A = 1;
406
        const B = 1 << 1;
407
        const C = 0b0000_0100;
408
    }
409
}
410
```
411
412
# Named and unnamed flags
413
414
Constants in the body of a declaration are flags. The identifier of the constant is the name of
415
the flag. If the identifier is `_`, then the flag is unnamed. Unnamed flags don't appear in the
416
generated API, but affect how bits are truncated.
417
418
## Examples
419
420
Adding an unnamed flag that makes all bits known:
421
422
```
423
# use bitflags::bitflags;
424
bitflags! {
425
    struct Flags: u8 {
426
        const A = 1;
427
        const B = 1 << 1;
428
429
        const _ = !0;
430
    }
431
}
432
```
433
434
Flags types may define multiple unnamed flags:
435
436
```
437
# use bitflags::bitflags;
438
bitflags! {
439
    struct Flags: u8 {
440
        const _ = 1;
441
        const _ = 1 << 1;
442
    }
443
}
444
```
445
*/
446
#[macro_export]
447
macro_rules! bitflags {
448
    (
449
        $(#[$outer:meta])*
450
        $vis:vis struct $BitFlags:ident: $T:ty {
451
            $(
452
                $(#[$inner:ident $($args:tt)*])*
453
                const $Flag:tt = $value:expr;
454
            )*
455
        }
456
457
        $($t:tt)*
458
    ) => {
459
        // Declared in the scope of the `bitflags!` call
460
        // This type appears in the end-user's API
461
        $crate::__declare_public_bitflags! {
462
            $(#[$outer])*
463
            $vis struct $BitFlags
464
        }
465
466
        // Workaround for: https://github.com/bitflags/bitflags/issues/320
467
        $crate::__impl_public_bitflags_consts! {
468
            $BitFlags: $T {
469
                $(
470
                    $(#[$inner $($args)*])*
471
                    const $Flag = $value;
472
                )*
473
            }
474
        }
475
476
        #[allow(
477
            dead_code,
478
            deprecated,
479
            unused_doc_comments,
480
            unused_attributes,
481
            unused_mut,
482
            unused_imports,
483
            non_upper_case_globals,
484
            clippy::assign_op_pattern,
485
            clippy::indexing_slicing,
486
            clippy::same_name_method,
487
            clippy::iter_without_into_iter,
488
        )]
489
        const _: () = {
490
            // Declared in a "hidden" scope that can't be reached directly
491
            // These types don't appear in the end-user's API
492
            $crate::__declare_internal_bitflags! {
493
                $vis struct InternalBitFlags: $T
494
            }
495
496
            $crate::__impl_internal_bitflags! {
497
                InternalBitFlags: $T, $BitFlags {
498
                    $(
499
                        $(#[$inner $($args)*])*
500
                        const $Flag = $value;
501
                    )*
502
                }
503
            }
504
505
            // This is where new library trait implementations can be added
506
            $crate::__impl_external_bitflags! {
507
                InternalBitFlags: $T, $BitFlags {
508
                    $(
509
                        $(#[$inner $($args)*])*
510
                        const $Flag;
511
                    )*
512
                }
513
            }
514
515
            $crate::__impl_public_bitflags_forward! {
516
                $BitFlags: $T, InternalBitFlags
517
            }
518
519
            $crate::__impl_public_bitflags_ops! {
520
                $BitFlags
521
            }
522
523
            $crate::__impl_public_bitflags_iter! {
524
                $BitFlags: $T, $BitFlags
525
            }
526
        };
527
528
        $crate::bitflags! {
529
            $($t)*
530
        }
531
    };
532
    (
533
        $(#[$outer:meta])*
534
        impl $BitFlags:ident: $T:ty {
535
            $(
536
                $(#[$inner:ident $($args:tt)*])*
537
                const $Flag:tt = $value:expr;
538
            )*
539
        }
540
541
        $($t:tt)*
542
    ) => {
543
        $crate::__impl_public_bitflags_consts! {
544
            $BitFlags: $T {
545
                $(
546
                    $(#[$inner $($args)*])*
547
                    const $Flag = $value;
548
                )*
549
            }
550
        }
551
552
        #[allow(
553
            dead_code,
554
            deprecated,
555
            unused_doc_comments,
556
            unused_attributes,
557
            unused_mut,
558
            unused_imports,
559
            non_upper_case_globals,
560
            clippy::assign_op_pattern,
561
            clippy::iter_without_into_iter,
562
        )]
563
        const _: () = {
564
            $crate::__impl_public_bitflags! {
565
                $(#[$outer])*
566
                $BitFlags: $T, $BitFlags {
567
                    $(
568
                        $(#[$inner $($args)*])*
569
                        const $Flag = $value;
570
                    )*
571
                }
572
            }
573
574
            $crate::__impl_public_bitflags_ops! {
575
                $BitFlags
576
            }
577
578
            $crate::__impl_public_bitflags_iter! {
579
                $BitFlags: $T, $BitFlags
580
            }
581
        };
582
583
        $crate::bitflags! {
584
            $($t)*
585
        }
586
    };
587
    () => {};
588
}
589
590
/// Implement functions on bitflags types.
591
///
592
/// We need to be careful about adding new methods and trait implementations here because they
593
/// could conflict with items added by the end-user.
594
#[macro_export]
595
#[doc(hidden)]
596
macro_rules! __impl_bitflags {
597
    (
598
        $(#[$outer:meta])*
599
        $PublicBitFlags:ident: $T:ty {
600
            fn empty() $empty:block
601
            fn all() $all:block
602
            fn bits($bits0:ident) $bits:block
603
            fn from_bits($from_bits0:ident) $from_bits:block
604
            fn from_bits_truncate($from_bits_truncate0:ident) $from_bits_truncate:block
605
            fn from_bits_retain($from_bits_retain0:ident) $from_bits_retain:block
606
            fn from_name($from_name0:ident) $from_name:block
607
            fn is_empty($is_empty0:ident) $is_empty:block
608
            fn is_all($is_all0:ident) $is_all:block
609
            fn intersects($intersects0:ident, $intersects1:ident) $intersects:block
610
            fn contains($contains0:ident, $contains1:ident) $contains:block
611
            fn insert($insert0:ident, $insert1:ident) $insert:block
612
            fn remove($remove0:ident, $remove1:ident) $remove:block
613
            fn toggle($toggle0:ident, $toggle1:ident) $toggle:block
614
            fn set($set0:ident, $set1:ident, $set2:ident) $set:block
615
            fn intersection($intersection0:ident, $intersection1:ident) $intersection:block
616
            fn union($union0:ident, $union1:ident) $union:block
617
            fn difference($difference0:ident, $difference1:ident) $difference:block
618
            fn symmetric_difference($symmetric_difference0:ident, $symmetric_difference1:ident) $symmetric_difference:block
619
            fn complement($complement0:ident) $complement:block
620
        }
621
    ) => {
622
        #[allow(dead_code, deprecated, unused_attributes)]
623
        $(#[$outer])*
624
        impl $PublicBitFlags {
625
            /// Get a flags value with all bits unset.
626
            #[inline]
627
0
            pub const fn empty() -> Self {
628
0
                $empty
629
0
            }
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::empty
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::empty
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::empty
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::empty
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::empty
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::empty
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::empty
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::empty
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::empty
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::empty
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::empty
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::empty
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::empty
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::empty
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::empty
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::empty
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::empty
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::empty
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::empty
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::empty
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::empty
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::empty
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::empty
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::empty
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::empty
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::empty
630
631
            /// Get a flags value with all known bits set.
632
            #[inline]
633
0
            pub const fn all() -> Self {
634
0
                $all
635
0
            }
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::all
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::all
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::all
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::all
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::all
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::all
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::all
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::all
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::all
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::all
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::all
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::all
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::all
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::all
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::all
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::all
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::all
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::all
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::all
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::all
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::all
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::all
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::all
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::all
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::all
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::all
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::all
636
637
            /// Get the underlying bits value.
638
            ///
639
            /// The returned value is exactly the bits set in this flags value.
640
            #[inline]
641
0
            pub const fn bits(&self) -> $T {
642
0
                let $bits0 = self;
643
0
                $bits
644
0
            }
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::bits
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::bits
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::bits
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::bits
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::bits
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::bits
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::bits
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::bits
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::bits
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::bits
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::bits
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::bits
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::bits
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::bits
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::bits
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::bits
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::bits
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::bits
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::bits
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::bits
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::bits
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::bits
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::bits
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::bits
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::bits
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::bits
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::bits
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::bits
645
646
            /// Convert from a bits value.
647
            ///
648
            /// This method will return `None` if any unknown bits are set.
649
            #[inline]
650
0
            pub const fn from_bits(bits: $T) -> $crate::__private::core::option::Option<Self> {
651
0
                let $from_bits0 = bits;
652
                $from_bits
653
0
            }
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::from_bits
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::from_bits
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::from_bits
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::from_bits
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::from_bits
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::from_bits
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::from_bits
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::from_bits
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::from_bits
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::from_bits
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::from_bits
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::from_bits
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::from_bits
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::from_bits
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::from_bits
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::from_bits
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::from_bits
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::from_bits
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::from_bits
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::from_bits
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::from_bits
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::from_bits
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::from_bits
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::from_bits
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::from_bits
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::from_bits
654
0
655
0
            /// Convert from a bits value, unsetting any unknown bits.
656
0
            #[inline]
657
0
            pub const fn from_bits_truncate(bits: $T) -> Self {
658
0
                let $from_bits_truncate0 = bits;
659
0
                $from_bits_truncate
660
0
            }
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::from_bits_truncate
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::from_bits_truncate
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::from_bits_truncate
661
662
            /// Convert from a bits value exactly.
663
            #[inline]
664
0
            pub const fn from_bits_retain(bits: $T) -> Self {
665
0
                let $from_bits_retain0 = bits;
666
0
                $from_bits_retain
667
0
            }
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::from_bits_retain
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::from_bits_retain
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::from_bits_retain
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::from_bits_retain
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::from_bits_retain
668
669
            /// Get a flags value with the bits of a flag with the given name set.
670
            ///
671
            /// This method will return `None` if `name` is empty or doesn't
672
            /// correspond to any named flag.
673
            #[inline]
674
0
            pub fn from_name(name: &str) -> $crate::__private::core::option::Option<Self> {
675
0
                let $from_name0 = name;
676
                $from_name
677
0
            }
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::from_name
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::from_name
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::from_name
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::from_name
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::from_name
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::from_name
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::from_name
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::from_name
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::from_name
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::from_name
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::from_name
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::from_name
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::from_name
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::from_name
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::from_name
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::from_name
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::from_name
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::from_name
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::from_name
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::from_name
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::from_name
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::from_name
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::from_name
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::from_name
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::from_name
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::from_name
678
0
679
0
            /// Whether all bits in this flags value are unset.
680
0
            #[inline]
681
0
            pub const fn is_empty(&self) -> bool {
682
0
                let $is_empty0 = self;
683
0
                $is_empty
684
0
            }
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::is_empty
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::is_empty
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::is_empty
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::is_empty
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::is_empty
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::is_empty
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::is_empty
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::is_empty
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::is_empty
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::is_empty
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::is_empty
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::is_empty
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::is_empty
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::is_empty
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::is_empty
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::is_empty
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::is_empty
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::is_empty
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::is_empty
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::is_empty
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::is_empty
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::is_empty
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::is_empty
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::is_empty
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::is_empty
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::is_empty
685
686
            /// Whether all known bits in this flags value are set.
687
            #[inline]
688
0
            pub const fn is_all(&self) -> bool {
689
0
                let $is_all0 = self;
690
0
                $is_all
691
0
            }
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::is_all
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::is_all
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::is_all
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::is_all
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::is_all
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::is_all
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::is_all
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::is_all
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::is_all
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::is_all
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::is_all
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::is_all
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::is_all
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::is_all
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::is_all
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::is_all
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::is_all
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::is_all
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::is_all
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::is_all
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::is_all
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::is_all
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::is_all
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::is_all
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::is_all
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::is_all
692
693
            /// Whether any set bits in a source flags value are also set in a target flags value.
694
            #[inline]
695
0
            pub const fn intersects(&self, other: Self) -> bool {
696
0
                let $intersects0 = self;
697
0
                let $intersects1 = other;
698
0
                $intersects
699
0
            }
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::intersects
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::intersects
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::intersects
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::intersects
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::intersects
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::intersects
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::intersects
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::intersects
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::intersects
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::intersects
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::intersects
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::intersects
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::intersects
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::intersects
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::intersects
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::intersects
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::intersects
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::intersects
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::intersects
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::intersects
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::intersects
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::intersects
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::intersects
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::intersects
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::intersects
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::intersects
700
701
            /// Whether all set bits in a source flags value are also set in a target flags value.
702
            #[inline]
703
0
            pub const fn contains(&self, other: Self) -> bool {
704
0
                let $contains0 = self;
705
0
                let $contains1 = other;
706
0
                $contains
707
0
            }
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::contains
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::contains
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::contains
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::contains
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::contains
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::contains
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::contains
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::contains
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::contains
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::contains
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::contains
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::contains
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::contains
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::contains
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::contains
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::contains
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::contains
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::contains
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::contains
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::contains
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::contains
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::contains
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::contains
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::contains
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::contains
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::contains
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::contains
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::contains
708
709
            /// The bitwise or (`|`) of the bits in two flags values.
710
            #[inline]
711
0
            pub fn insert(&mut self, other: Self) {
712
0
                let $insert0 = self;
713
0
                let $insert1 = other;
714
0
                $insert
715
0
            }
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::insert
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::insert
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::insert
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::insert
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::insert
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::insert
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::insert
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::insert
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::insert
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::insert
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::insert
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::insert
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::insert
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::insert
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::insert
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::insert
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::insert
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::insert
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::insert
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::insert
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::insert
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::insert
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::insert
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::insert
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::insert
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::insert
716
717
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
718
            ///
719
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
720
            /// `remove` won't truncate `other`, but the `!` operator will.
721
            #[inline]
722
0
            pub fn remove(&mut self, other: Self) {
723
0
                let $remove0 = self;
724
0
                let $remove1 = other;
725
0
                $remove
726
0
            }
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::remove
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::remove
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::remove
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::remove
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::remove
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::remove
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::remove
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::remove
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::remove
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::remove
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::remove
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::remove
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::remove
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::remove
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::remove
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::remove
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::remove
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::remove
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::remove
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::remove
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::remove
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::remove
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::remove
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::remove
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::remove
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::remove
727
728
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
729
            #[inline]
730
0
            pub fn toggle(&mut self, other: Self) {
731
0
                let $toggle0 = self;
732
0
                let $toggle1 = other;
733
0
                $toggle
734
0
            }
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::toggle
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::toggle
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::toggle
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::toggle
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::toggle
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::toggle
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::toggle
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::toggle
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::toggle
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::toggle
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::toggle
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::toggle
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::toggle
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::toggle
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::toggle
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::toggle
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::toggle
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::toggle
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::toggle
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::toggle
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::toggle
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::toggle
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::toggle
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::toggle
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::toggle
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::toggle
735
736
            /// Call `insert` when `value` is `true` or `remove` when `value` is `false`.
737
            #[inline]
738
0
            pub fn set(&mut self, other: Self, value: bool) {
739
0
                let $set0 = self;
740
0
                let $set1 = other;
741
0
                let $set2 = value;
742
0
                $set
743
0
            }
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::set
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::set
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::set
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::set
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::set
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::set
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::set
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::set
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::set
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::set
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::set
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::set
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::set
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::set
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::set
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::set
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::set
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::set
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::set
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::set
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::set
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::set
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::set
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::set
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::set
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::set
744
0
745
0
            /// The bitwise and (`&`) of the bits in two flags values.
746
0
            #[inline]
747
0
            #[must_use]
748
0
            pub const fn intersection(self, other: Self) -> Self {
749
0
                let $intersection0 = self;
750
0
                let $intersection1 = other;
751
0
                $intersection
752
0
            }
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::intersection
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::intersection
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::intersection
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::intersection
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::intersection
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::intersection
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::intersection
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::intersection
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::intersection
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::intersection
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::intersection
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::intersection
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::intersection
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::intersection
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::intersection
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::intersection
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::intersection
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::intersection
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::intersection
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::intersection
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::intersection
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::intersection
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::intersection
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::intersection
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::intersection
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::intersection
753
754
            /// The bitwise or (`|`) of the bits in two flags values.
755
            #[inline]
756
            #[must_use]
757
0
            pub const fn union(self, other: Self) -> Self {
758
0
                let $union0 = self;
759
0
                let $union1 = other;
760
0
                $union
761
0
            }
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::union
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::union
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::union
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::union
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::union
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::union
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::union
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::union
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::union
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::union
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::union
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::union
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::union
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::union
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::union
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::union
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::union
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::union
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::union
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::union
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::union
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::union
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::union
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::union
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::union
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::union
762
763
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
764
            ///
765
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
766
            /// `difference` won't truncate `other`, but the `!` operator will.
767
            #[inline]
768
            #[must_use]
769
0
            pub const fn difference(self, other: Self) -> Self {
770
0
                let $difference0 = self;
771
0
                let $difference1 = other;
772
0
                $difference
773
0
            }
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::difference
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::difference
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::difference
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::difference
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::difference
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::difference
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::difference
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::difference
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::difference
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::difference
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::difference
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::difference
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::difference
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::difference
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::difference
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::difference
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::difference
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::difference
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::difference
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::difference
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::difference
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::difference
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::difference
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::difference
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::difference
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::difference
774
775
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
776
            #[inline]
777
            #[must_use]
778
0
            pub const fn symmetric_difference(self, other: Self) -> Self {
779
0
                let $symmetric_difference0 = self;
780
0
                let $symmetric_difference1 = other;
781
0
                $symmetric_difference
782
0
            }
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::symmetric_difference
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::symmetric_difference
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::symmetric_difference
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::symmetric_difference
783
784
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
785
            #[inline]
786
            #[must_use]
787
0
            pub const fn complement(self) -> Self {
788
0
                let $complement0 = self;
789
0
                $complement
790
0
            }
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::complement
Unexecuted instantiation: <x86_64::registers::control::Cr0Flags>::complement
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::complement
Unexecuted instantiation: <x86_64::registers::control::Cr3Flags>::complement
Unexecuted instantiation: <x86_64::registers::control::_::InternalBitFlags>::complement
Unexecuted instantiation: <x86_64::registers::control::Cr4Flags>::complement
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::complement
Unexecuted instantiation: <x86_64::registers::debug::Dr6Flags>::complement
Unexecuted instantiation: <x86_64::registers::debug::_::InternalBitFlags>::complement
Unexecuted instantiation: <x86_64::registers::debug::Dr7Flags>::complement
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::complement
Unexecuted instantiation: <x86_64::registers::model_specific::EferFlags>::complement
Unexecuted instantiation: <x86_64::registers::model_specific::_::InternalBitFlags>::complement
Unexecuted instantiation: <x86_64::registers::model_specific::CetFlags>::complement
Unexecuted instantiation: <x86_64::registers::mxcsr::_::InternalBitFlags>::complement
Unexecuted instantiation: <x86_64::registers::mxcsr::MxCsr>::complement
Unexecuted instantiation: <x86_64::registers::rflags::_::InternalBitFlags>::complement
Unexecuted instantiation: <x86_64::registers::rflags::RFlags>::complement
Unexecuted instantiation: <x86_64::registers::xcontrol::_::InternalBitFlags>::complement
Unexecuted instantiation: <x86_64::registers::xcontrol::XCr0Flags>::complement
Unexecuted instantiation: <x86_64::structures::gdt::_::InternalBitFlags>::complement
Unexecuted instantiation: <x86_64::structures::gdt::DescriptorFlags>::complement
Unexecuted instantiation: <x86_64::structures::idt::_::InternalBitFlags>::complement
Unexecuted instantiation: <x86_64::structures::idt::PageFaultErrorCode>::complement
Unexecuted instantiation: <x86_64::structures::paging::page_table::_::InternalBitFlags>::complement
Unexecuted instantiation: <x86_64::structures::paging::page_table::PageTableFlags>::complement
791
        }
792
    };
793
}
794
795
/// A macro that processed the input to `bitflags!` and shuffles attributes around
796
/// based on whether or not they're "expression-safe".
797
///
798
/// This macro is a token-tree muncher that works on 2 levels:
799
///
800
/// For each attribute, we explicitly match on its identifier, like `cfg` to determine
801
/// whether or not it should be considered expression-safe.
802
///
803
/// If you find yourself with an attribute that should be considered expression-safe
804
/// and isn't, it can be added here.
805
#[macro_export]
806
#[doc(hidden)]
807
macro_rules! __bitflags_expr_safe_attrs {
808
    // Entrypoint: Move all flags and all attributes into `unprocessed` lists
809
    // where they'll be munched one-at-a-time
810
    (
811
        $(#[$inner:ident $($args:tt)*])*
812
        { $e:expr }
813
    ) => {
814
        $crate::__bitflags_expr_safe_attrs! {
815
            expr: { $e },
816
            attrs: {
817
                // All attributes start here
818
                unprocessed: [$(#[$inner $($args)*])*],
819
                // Attributes that are safe on expressions go here
820
                processed: [],
821
            },
822
        }
823
    };
824
    // Process the next attribute on the current flag
825
    // `cfg`: The next flag should be propagated to expressions
826
    // NOTE: You can copy this rules block and replace `cfg` with
827
    // your attribute name that should be considered expression-safe
828
    (
829
        expr: { $e:expr },
830
            attrs: {
831
            unprocessed: [
832
                // cfg matched here
833
                #[cfg $($args:tt)*]
834
                $($attrs_rest:tt)*
835
            ],
836
            processed: [$($expr:tt)*],
837
        },
838
    ) => {
839
        $crate::__bitflags_expr_safe_attrs! {
840
            expr: { $e },
841
            attrs: {
842
                unprocessed: [
843
                    $($attrs_rest)*
844
                ],
845
                processed: [
846
                    $($expr)*
847
                    // cfg added here
848
                    #[cfg $($args)*]
849
                ],
850
            },
851
        }
852
    };
853
    // Process the next attribute on the current flag
854
    // `$other`: The next flag should not be propagated to expressions
855
    (
856
        expr: { $e:expr },
857
            attrs: {
858
            unprocessed: [
859
                // $other matched here
860
                #[$other:ident $($args:tt)*]
861
                $($attrs_rest:tt)*
862
            ],
863
            processed: [$($expr:tt)*],
864
        },
865
    ) => {
866
        $crate::__bitflags_expr_safe_attrs! {
867
            expr: { $e },
868
                attrs: {
869
                unprocessed: [
870
                    $($attrs_rest)*
871
                ],
872
                processed: [
873
                    // $other not added here
874
                    $($expr)*
875
                ],
876
            },
877
        }
878
    };
879
    // Once all attributes on all flags are processed, generate the actual code
880
    (
881
        expr: { $e:expr },
882
        attrs: {
883
            unprocessed: [],
884
            processed: [$(#[$expr:ident $($exprargs:tt)*])*],
885
        },
886
    ) => {
887
        $(#[$expr $($exprargs)*])*
888
        { $e }
889
    }
890
}
891
892
/// Implement a flag, which may be a wildcard `_`.
893
#[macro_export]
894
#[doc(hidden)]
895
macro_rules! __bitflags_flag {
896
    (
897
        {
898
            name: _,
899
            named: { $($named:tt)* },
900
            unnamed: { $($unnamed:tt)* },
901
        }
902
    ) => {
903
        $($unnamed)*
904
    };
905
    (
906
        {
907
            name: $Flag:ident,
908
            named: { $($named:tt)* },
909
            unnamed: { $($unnamed:tt)* },
910
        }
911
    ) => {
912
        $($named)*
913
    };
914
}
915
916
#[macro_use]
917
mod public;
918
#[macro_use]
919
mod internal;
920
#[macro_use]
921
mod external;
922
923
#[cfg(feature = "example_generated")]
924
pub mod example_generated;
925
926
#[cfg(test)]
927
mod tests;