pub trait BitSafe {
    type Mem: BitRegister;
    type Rad: Radium<Item = Self::Mem>;

    const ZERO: Self;

    fn load(&self) -> Self::Mem;
}
Expand description

Read-Only Semivolatile Handle

This trait describes views of memory that are not permitted to modify the value they reference, but must tolerate external modification to that value. Implementors must tolerate shared-mutability behaviors, but are not allowed to expose shared mutation APIs. They are permitted to modify the referent only under &mut exclusive references.

This behavior enables an important aspect of the bitvec memory model when working with memory elements that multiple &mut BitSlice references touch: each BitSlice needs to be able to give the caller a view of the memory element, but they also need to prevent modification of bits outside of their span. This trait enables callers to view raw underlying memory without improperly modifying memory that other &mut BitSlices expect to be stable.

Required Associated Types

The element type being guarded against improper mutation.

This is only present as an extra proof that the type graph has a consistent view of the underlying memory.

The memory-access type this guards.

This is exposed as an associated type so that BitStore can name it without having to re-select it based on crate configuration.

Required Associated Constants

The zero constant.

Required Methods

Loads the value from memory, allowing for the possibility that other handles have write permissions to it.

Implementors