Debian Codegraph @

debian/rust-vendor/bitvec/doc/index/BitSel.md

raw
1 # One-Hot Bit Selection Mask
2
3 This type selects exactly one bit in a register. It is a [`BitPos`] shifted from
4 a counter to a selector, and is used to apply test and write operations to real
5 memory.
6
7 ## Type Parameters
8
9 - `R`: The register element this selector governs.
10
11 ## Validity
12
13 Values of this type are **required** to have exactly one bit set and all others
14 cleared. Any other value makes the program incorrect, and will cause memory
15 corruption.
16
17 ## Construction
18
19 This type is only constructed from `BitPos`, and is always equivalent to
20 `1 << BitPos`.
21
22 The chain of custody from known-good [`BitIdx`] values, through proven-good
23 [`BitOrder`] implementations, into `BitPos` and then `BitSel` proves that values
24 of this type are always correct to apply to real memory.
25
26 [`BitIdx`]: crate::index::BitIdx
27 [`BitOrder`]: crate::order::BitOrder
28 [`BitPos`]: crate::index::BitPos