reth_revm::interpreter::primitives::bitvec::prelude

Trait AsBits

pub trait AsBits<T>
where T: BitStore,
{ // Required methods fn as_bits<O>(&self) -> &BitSlice<T, O> where O: BitOrder; fn try_as_bits<O>(&self) -> Result<&BitSlice<T, O>, BitSpanError<T>> where O: BitOrder; }
Expand description

§Immutable Bit View

This trait is an analogue to the AsRef trait, in that it enables any type to provide a view of an immutable bit-slice.

It does not require an AsRef<[T: BitStore]> implementation, but a blanket implementation for all AsRef<[T: BitStore]> is provided. This allows you to choose whether to implement only one of AsBits<T> or AsRef<[T]>, and gain a bit-slice view through either choice.

§Usage

The .as_bits<_>() method has the same usage patterns as BitView::view_bits.

§Notes

You are not forbidden from creating multiple views with different element types to the same region, but doing so is likely to cause inconsistent and surprising behavior.

Refrain from implementing this trait with more than one storage argument unless you are sure that you can uphold the memory region requirements of all of them, and are aware of the behavior conflicts that may arise.

Required Methods§

fn as_bits<O>(&self) -> &BitSlice<T, O>
where O: BitOrder,

Views self as an immutable bit-slice region with the O ordering.

fn try_as_bits<O>(&self) -> Result<&BitSlice<T, O>, BitSpanError<T>>
where O: BitOrder,

Attempts to view self as an immutable bit-slice region with the O ordering.

This may return an error if self is too long to view as a bit-slice.

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§

§

impl<A, T> AsBits<T> for A
where A: AsRef<[T]>, T: BitStore,

Available on non-tarpaulin_include only.