Debian Codegraph @

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

raw
1 # Semantic Bit Index
2
3 This type is a counter in the ring `0 .. R::BITS` and serves to mark a semantic
4 index within some register element. It is a virtual index, and is the stored
5 value used in pointer encodings to track region start information.
6
7 It is translated to a real index through the [`BitOrder`] trait. This virtual
8 index is the only counter that can be used for address computation, and once
9 lowered to an electrical index through [`BitOrder::at`], the electrical address
10 can only be used for setting up machine instructions.
11
12 ## Type Parameters
13
14 - `R`: The register element that this index governs.
15
16 ## Validity
17
18 Values of this type are **required** to be in the range `0 .. R::BITS`. Any
19 value not less than [`R::BITS`] makes the program invalid, and will likely cause
20 either a crash or incorrect memory access.
21
22 ## Construction
23
24 This type can never be constructed outside of the `bitvec` crate. It is passed
25 in to [`BitOrder`] implementations, which may use it to construct electrical
26 position values from it. All values of this type constructed by `bitvec` are
27 known to be correct in their region; no other construction site can be trusted.
28
29 [`BitOrder`]: crate::order::BitOrder
30 [`BitOrder::at`]: crate::order::BitOrder::at
31 [`R::BITS`]: funty::Integral::BITS