| 1 |
# Bit-Level Access Instructions |
| 2 |
|
| 3 |
This trait extends [`Radium`] in order to manipulate specific bits in an element |
| 4 |
according to the crate’s logic. It drives all memory access instructions and is |
| 5 |
responsible for translating the bit-selection logic of the [`index`] module into |
| 6 |
real effects. |
| 7 |
|
| 8 |
This is blanket-implemented on all types that permit shared-mutable memory |
| 9 |
access via the [`radium`] crate. Its use is constrained in the [`store`] module. |
| 10 |
It is required to be a publicly accessible symbol, as it is exported in other |
| 11 |
traits, but it is a crate-internal item and is not part of the public API. Its |
| 12 |
blanket implementation for `<R: Radium>` prevents any other implementations from |
| 13 |
being written. |
| 14 |
|
| 15 |
## Implementation and Safety Notes |
| 16 |
|
| 17 |
This trait is automatically implemented for all types that implement `Radium`, |
| 18 |
and relies exclusively on `Radium`’s API and implementations for its work. In |
| 19 |
particular, `Radium` has no functions which operate on **pointers**: it |
| 20 |
exclusively operates on memory through **references**. Since references must |
| 21 |
always refer to initialized memory, `BitAccess` and, by extension, all APIs in |
| 22 |
`bitvec` that touch memory, cannot be used to operate on uninitialized memory in |
| 23 |
any way. |
| 24 |
|
| 25 |
While you may *create* a `bitvec` pointer object that targets uninitialized |
| 26 |
memory, you may not *dereference* it until the targeted memory has been wholly |
| 27 |
initialized with integer values. |
| 28 |
|
| 29 |
This restriction cannot be loosened without stable access to pointer-based |
| 30 |
atomic intrinsics in the Rust standard library and corresponding updates to the |
| 31 |
`Radium` trait. |
| 32 |
|
| 33 |
Do not attempt to access uninitialized memory through `bitvec`. Doing so will |
| 34 |
cause `bitvec` to produce references to uninitialized memory, which is undefined |
| 35 |
behavior. |
| 36 |
|
| 37 |
[`Radium`]: radium::Radium |
| 38 |
[`index`]: crate::index |
| 39 |
[`radium`]: radium |
| 40 |
[`store`]: crate::store |