reth_node_core::primitives::revm_primitives::bitvec::prelude

Trait BitStore

pub trait BitStore: 'static + Debug {
    type Mem: BitRegister + BitStore<Mem = Self::Mem>;
    type Access: BitAccess<Item = Self::Mem> + BitStore<Mem = Self::Mem>;
    type Alias: BitStore<Mem = Self::Mem>;
    type Unalias: BitStore<Mem = Self::Mem>;

    const ZERO: Self;
    const ALIGNED_TO_SIZE: [(); 1];
    const ALIAS_WIDTH: [(); 1];

    // Required methods
    fn new(value: Self::Mem) -> Self;
    fn load_value(&self) -> Self::Mem;
    fn store_value(&mut self, value: Self::Mem);

    // Provided method
    fn get_bit<O>(&self, index: BitIdx<Self::Mem>) -> bool
       where O: BitOrder { ... }
}
Expand description

§Bit Storage

This trait drives bitvec’s ability to view memory as a collection of discrete bits. It combines awareness of storage element width, memory-bus access requirements, element contention, and buffer management, into a type-system graph that the rest of the crate can use to abstract away concerns about memory representation or access rules.

It is responsible for extending the standard Rust &/&mut shared/exclusion rules to apply to individual bits while avoiding violating those rules when operating on real memory so that Rust and LLVM cannot find fault with the object code it produces.

§Implementors

This is implemented on three type families:

The BitSlice region, and all structures composed atop it, can be built out of regions of memory that have this trait implementation.

§Associated Types

The associated types attached to each implementation create a closed graph of type transitions used to manage alias conditions. When a bit-slice region determines that an aliasing or unaliasing event has occurred, it transitions along the type graph in order to maintain correct operations in memory. The methods that cause type transitions can be found in BitSlice and domain.

Required Associated Constants§

const ZERO: Self

The zero constant.

const ALIGNED_TO_SIZE: [(); 1]

All implementors are required to have their alignment match their size.

Use mem::aligned_to_size::<Self>() to prove this.

const ALIAS_WIDTH: [(); 1]

All implementors are required to have Self and Self::Alias be equal in representation. This is true by fiat for all types except the unsigned integers.

Use mem::layout_eq::<Self, Self::Alias>() to prove this.

Required Associated Types§

type Mem: BitRegister + BitStore<Mem = Self::Mem>

The element type used in the memory region underlying a BitSlice. It is always one of the unsigned integer fundamentals.

type Access: BitAccess<Item = Self::Mem> + BitStore<Mem = Self::Mem>

A type that selects the appropriate load/store instructions when accessing the memory bus. It determines what instructions are used when moving a Self::Mem value between the processor and the memory system.

This must be at least able to manage aliasing.

type Alias: BitStore<Mem = Self::Mem>

A sibling BitStore implementor that is known to be alias-safe. It is used when a BitSlice introduces multiple handles that view the same memory location, and at least one of them has write capabilities to it. It must have the same underlying memory type, and can only change access patterns or public-facing usage.

type Unalias: BitStore<Mem = Self::Mem>

The inverse of ::Alias. It is used when a BitSlice removes the conditions that required a T -> T::Alias transition.

Required Methods§

fn new(value: Self::Mem) -> Self

Wraps a raw memory value as a BitStore type.

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

Loads a value out of the memory system according to the ::Access rules. This may be called when the value is aliased by a write-capable reference.

fn store_value(&mut self, value: Self::Mem)

Stores a value into the memory system. This is only called when there are no other handles to the value, and it may bypass ::Access constraints.

Provided Methods§

fn get_bit<O>(&self, index: BitIdx<Self::Mem>) -> bool
where O: BitOrder,

Reads a single bit out of the memory system according to the ::Access rules. This is lifted from BitAccess so that it can be used elsewhere without additional casts.

§Type Parameters
  • O: The ordering of bits within Self::Mem governing the lookup.
§Parameters
  • index: The semantic index of a bit in *self.
§Returns

The value of the bit in *self at BitOrder::at(index).

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.

Implementations on Foreign Types§

§

impl BitStore for u8

§

type Access = Cell<u8>

The unsigned integers will only be BitStore type parameters for handles to unaliased memory, following the normal Rust reference rules.

§

const ZERO: u8 = 0u8

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u8

§

type Alias = BitSafeU8

§

type Unalias = u8

§

fn new(value: <u8 as BitStore>::Mem) -> u8

§

fn load_value(&self) -> <u8 as BitStore>::Mem

§

fn store_value(&mut self, value: <u8 as BitStore>::Mem)

§

impl BitStore for u16

§

type Access = Cell<u16>

The unsigned integers will only be BitStore type parameters for handles to unaliased memory, following the normal Rust reference rules.

§

const ZERO: u16 = 0u16

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u16

§

type Alias = BitSafeU16

§

type Unalias = u16

§

fn new(value: <u16 as BitStore>::Mem) -> u16

§

fn load_value(&self) -> <u16 as BitStore>::Mem

§

fn store_value(&mut self, value: <u16 as BitStore>::Mem)

§

impl BitStore for u32

§

type Access = Cell<u32>

The unsigned integers will only be BitStore type parameters for handles to unaliased memory, following the normal Rust reference rules.

§

const ZERO: u32 = 0u32

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u32

§

type Alias = BitSafeU32

§

type Unalias = u32

§

fn new(value: <u32 as BitStore>::Mem) -> u32

§

fn load_value(&self) -> <u32 as BitStore>::Mem

§

fn store_value(&mut self, value: <u32 as BitStore>::Mem)

§

impl BitStore for u64

§

type Access = Cell<u64>

The unsigned integers will only be BitStore type parameters for handles to unaliased memory, following the normal Rust reference rules.

§

const ZERO: u64 = 0u64

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u64

§

type Alias = BitSafeU64

§

type Unalias = u64

§

fn new(value: <u64 as BitStore>::Mem) -> u64

§

fn load_value(&self) -> <u64 as BitStore>::Mem

§

fn store_value(&mut self, value: <u64 as BitStore>::Mem)

§

impl BitStore for usize

§

type Access = Cell<usize>

The unsigned integers will only be BitStore type parameters for handles to unaliased memory, following the normal Rust reference rules.

§

const ZERO: usize = 0usize

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = usize

§

type Alias = BitSafeUsize

§

type Unalias = usize

§

fn new(value: <usize as BitStore>::Mem) -> usize

§

fn load_value(&self) -> <usize as BitStore>::Mem

§

fn store_value(&mut self, value: <usize as BitStore>::Mem)

§

impl BitStore for Cell<u8>

§

const ZERO: Cell<u8> = _

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u8

§

type Access = Cell<u8>

§

type Alias = Cell<u8>

§

type Unalias = Cell<u8>

§

fn new(value: <Cell<u8> as BitStore>::Mem) -> Cell<u8>

§

fn load_value(&self) -> <Cell<u8> as BitStore>::Mem

§

fn store_value(&mut self, value: <Cell<u8> as BitStore>::Mem)

§

impl BitStore for Cell<u16>

§

const ZERO: Cell<u16> = _

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u16

§

type Access = Cell<u16>

§

type Alias = Cell<u16>

§

type Unalias = Cell<u16>

§

fn new(value: <Cell<u16> as BitStore>::Mem) -> Cell<u16>

§

fn load_value(&self) -> <Cell<u16> as BitStore>::Mem

§

fn store_value(&mut self, value: <Cell<u16> as BitStore>::Mem)

§

impl BitStore for Cell<u32>

§

const ZERO: Cell<u32> = _

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u32

§

type Access = Cell<u32>

§

type Alias = Cell<u32>

§

type Unalias = Cell<u32>

§

fn new(value: <Cell<u32> as BitStore>::Mem) -> Cell<u32>

§

fn load_value(&self) -> <Cell<u32> as BitStore>::Mem

§

fn store_value(&mut self, value: <Cell<u32> as BitStore>::Mem)

§

impl BitStore for Cell<u64>

§

const ZERO: Cell<u64> = _

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u64

§

type Access = Cell<u64>

§

type Alias = Cell<u64>

§

type Unalias = Cell<u64>

§

fn new(value: <Cell<u64> as BitStore>::Mem) -> Cell<u64>

§

fn load_value(&self) -> <Cell<u64> as BitStore>::Mem

§

fn store_value(&mut self, value: <Cell<u64> as BitStore>::Mem)

§

impl BitStore for Cell<usize>

§

const ZERO: Cell<usize> = _

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = usize

§

type Access = Cell<usize>

§

type Alias = Cell<usize>

§

type Unalias = Cell<usize>

§

fn new(value: <Cell<usize> as BitStore>::Mem) -> Cell<usize>

§

fn load_value(&self) -> <Cell<usize> as BitStore>::Mem

§

fn store_value(&mut self, value: <Cell<usize> as BitStore>::Mem)

§

impl BitStore for AtomicU8

§

const ZERO: AtomicU8 = _

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u8

§

type Access = AtomicU8

§

type Alias = AtomicU8

§

type Unalias = AtomicU8

§

fn new(value: <AtomicU8 as BitStore>::Mem) -> AtomicU8

§

fn load_value(&self) -> <AtomicU8 as BitStore>::Mem

§

fn store_value(&mut self, value: <AtomicU8 as BitStore>::Mem)

§

impl BitStore for AtomicU16

§

const ZERO: AtomicU16 = _

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u16

§

type Access = AtomicU16

§

type Alias = AtomicU16

§

type Unalias = AtomicU16

§

fn new(value: <AtomicU16 as BitStore>::Mem) -> AtomicU16

§

fn load_value(&self) -> <AtomicU16 as BitStore>::Mem

§

fn store_value(&mut self, value: <AtomicU16 as BitStore>::Mem)

§

impl BitStore for AtomicU32

§

const ZERO: AtomicU32 = _

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u32

§

type Access = AtomicU32

§

type Alias = AtomicU32

§

type Unalias = AtomicU32

§

fn new(value: <AtomicU32 as BitStore>::Mem) -> AtomicU32

§

fn load_value(&self) -> <AtomicU32 as BitStore>::Mem

§

fn store_value(&mut self, value: <AtomicU32 as BitStore>::Mem)

§

impl BitStore for AtomicU64

§

const ZERO: AtomicU64 = _

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u64

§

type Access = AtomicU64

§

type Alias = AtomicU64

§

type Unalias = AtomicU64

§

fn new(value: <AtomicU64 as BitStore>::Mem) -> AtomicU64

§

fn load_value(&self) -> <AtomicU64 as BitStore>::Mem

§

fn store_value(&mut self, value: <AtomicU64 as BitStore>::Mem)

§

impl BitStore for AtomicUsize

§

const ZERO: AtomicUsize = _

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = usize

§

type Access = AtomicUsize

§

type Alias = AtomicUsize

§

type Unalias = AtomicUsize

§

fn new(value: <AtomicUsize as BitStore>::Mem) -> AtomicUsize

§

fn load_value(&self) -> <AtomicUsize as BitStore>::Mem

§

fn store_value(&mut self, value: <AtomicUsize as BitStore>::Mem)

Implementors§

§

impl BitStore for BitSafeU8

§

const ZERO: BitSafeU8 = <Self as BitSafe>::ZERO

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u8

§

type Access = <BitSafeU8 as BitSafe>::Rad

§

type Alias = BitSafeU8

§

type Unalias = u8

§

impl BitStore for BitSafeU16

§

const ZERO: BitSafeU16 = <Self as BitSafe>::ZERO

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u16

§

type Access = <BitSafeU16 as BitSafe>::Rad

§

type Alias = BitSafeU16

§

type Unalias = u16

§

impl BitStore for BitSafeU32

§

const ZERO: BitSafeU32 = <Self as BitSafe>::ZERO

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u32

§

type Access = <BitSafeU32 as BitSafe>::Rad

§

type Alias = BitSafeU32

§

type Unalias = u32

§

impl BitStore for BitSafeU64

§

const ZERO: BitSafeU64 = <Self as BitSafe>::ZERO

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = u64

§

type Access = <BitSafeU64 as BitSafe>::Rad

§

type Alias = BitSafeU64

§

type Unalias = u64

§

impl BitStore for BitSafeUsize

§

const ZERO: BitSafeUsize = <Self as BitSafe>::ZERO

§

const ALIGNED_TO_SIZE: [(); 1] = _

§

const ALIAS_WIDTH: [(); 1] = _

§

type Mem = usize

§

type Access = <BitSafeUsize as BitSafe>::Rad

§

type Alias = BitSafeUsize

§

type Unalias = usize