reth::core::primitives::revm_primitives::bitvec::access

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

Required Associated Constants§

const ZERO: Self

The zero constant.

Required Associated Types§

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.

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 Methods§

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

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

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.

Implementors§