Trait bitvec::access::BitSafe

source ·
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 BitSlices expect to be stable.

Required Associated Types§

source

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.

source

type Rad: Radium<Item = Self::Mem>

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§

source

const ZERO: Self

The zero constant.

Required Methods§

source

fn load(&self) -> Self::Mem

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

Implementors§

source§

impl BitSafe for BitSafeU8

§

type Mem = u8

§

type Rad = AtomicU8

source§

const ZERO: Self = _

source§

impl BitSafe for BitSafeU16

§

type Mem = u16

§

type Rad = AtomicU16

source§

const ZERO: Self = _

source§

impl BitSafe for BitSafeU32

§

type Mem = u32

§

type Rad = AtomicU32

source§

const ZERO: Self = _

source§

impl BitSafe for BitSafeU64

§

type Mem = u64

§

type Rad = AtomicU64

source§

const ZERO: Self = _

source§

impl BitSafe for BitSafeUsize

§

type Mem = usize

§

type Rad = AtomicUsize

source§

const ZERO: Self = _