Trait BitSafe
pub trait BitSafe {
type Mem: BitRegister;
type Rad: Radium<Item = Self::Mem>;
const ZERO: Self;
// Required method
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 BitSlice
s expect to be stable.
Required Associated Constants§
const ZERO: Self
const ZERO: Self
The zero constant.
Required Associated Types§
type Mem: BitRegister
type Mem: BitRegister
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.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.