| 1 |
# Bit Position |
| 2 |
|
| 3 |
This is a position counter of a real bit in an `R` memory element. |
| 4 |
|
| 5 |
Like [`BitIdx`], it is a counter in the ring `0 .. R::BITS`. It marks a real bit |
| 6 |
in memory, and is the shift distance in the expression `1 << n`. It can only be |
| 7 |
produced by applying [`BitOrder::at`] to an existing `BitIdx` produced by |
| 8 |
`bitvec`. |
| 9 |
|
| 10 |
## Type Parameters |
| 11 |
|
| 12 |
- `R`: The register element that this position governs. |
| 13 |
|
| 14 |
## Validity |
| 15 |
|
| 16 |
Values of this type are **required** to be in the range `0 .. R::BITS`. Any |
| 17 |
value not less than [`R::BITS`] makes the program invalid, and will likely cause |
| 18 |
either a crash or incorrect memory access. |
| 19 |
|
| 20 |
## Construction |
| 21 |
|
| 22 |
This type is publicly constructible, but is only correct to do so within an |
| 23 |
implementation of `BitOrder::at`. `bitvec` will only request its creation |
| 24 |
through that trait implementation, and has no sites that can publicly accept |
| 25 |
untrusted values. |
| 26 |
|
| 27 |
[`BitIdx`]: crate::index::BitIdx |
| 28 |
[`BitOrder::at`]: crate::order::BitOrder::at |
| 29 |
[`R::BITS`]: funty::Integral::BITS |