| 1 |
# Bit Storage |
| 2 |
|
| 3 |
This trait drives `bitvec`’s ability to view memory as a collection of discrete |
| 4 |
bits. It combines awareness of storage element width, memory-bus access |
| 5 |
requirements, element contention, and buffer management, into a type-system |
| 6 |
graph that the rest of the crate can use to abstract away concerns about memory |
| 7 |
representation or access rules. |
| 8 |
|
| 9 |
It is responsible for extending the standard Rust `&`/`&mut` shared/exclusion |
| 10 |
rules to apply to individual bits while avoiding violating those rules when |
| 11 |
operating on real memory so that Rust and LLVM cannot find fault with the object |
| 12 |
code it produces. |
| 13 |
|
| 14 |
## Implementors |
| 15 |
|
| 16 |
This is implemented on three type families: |
| 17 |
|
| 18 |
- all [`BitRegister`] raw integer fundamentals |
| 19 |
- all [`Cell`] wrappers of them |
| 20 |
- all [atomic] variants of them |
| 21 |
|
| 22 |
The [`BitSlice`] region, and all structures composed atop it, can be built out |
| 23 |
of regions of memory that have this trait implementation. |
| 24 |
|
| 25 |
## Associated Types |
| 26 |
|
| 27 |
The associated types attached to each implementation create a closed graph of |
| 28 |
type transitions used to manage alias conditions. When a bit-slice region |
| 29 |
determines that an aliasing or unaliasing event has occurred, it transitions |
| 30 |
along the type graph in order to maintain correct operations in memory. The |
| 31 |
methods that cause type transitions can be found in [`BitSlice`] and [`domain`]. |
| 32 |
|
| 33 |
[`BitRegister`]: crate::mem::BitRegister |
| 34 |
[`BitSlice`]: crate::slice::BitSlice |
| 35 |
[`Cell`]: core::cell::Cell |
| 36 |
[`domain`]: crate::domain |
| 37 |
[atomic]: core::sync::atomic |