cast::revm::interpreter::primitives::bitvec::slice

Trait BitSliceIndex

pub trait BitSliceIndex<'a, T, O>
where T: BitStore, O: BitOrder,
{ type Immut; type Mut; // Required methods fn get(self, bits: &'a BitSlice<T, O>) -> Option<Self::Immut>; fn get_mut(self, bits: &'a mut BitSlice<T, O>) -> Option<Self::Mut>; unsafe fn get_unchecked(self, bits: &'a BitSlice<T, O>) -> Self::Immut; unsafe fn get_unchecked_mut(self, bits: &'a mut BitSlice<T, O>) -> Self::Mut; fn index(self, bits: &'a BitSlice<T, O>) -> Self::Immut; fn index_mut(self, bits: &'a mut BitSlice<T, O>) -> Self::Mut; }
Expand description

§Bit-Slice Indexing

This trait, like its mirror in core, unifies various types that can be used to index within a bit-slice. Individual usize indices can refer to exactly one bit within a bit-slice, and R: RangeBounds<usize> ranges can refer to subslices of any length within a bit-slice.

The three operations (get, get unchecked, and index) reflect the three theories of lookup within a collection: fallible, pre-checked, and crashing on failure.

You will likely not use this trait directly; its methods all have corresponding methods on BitSlice that delegate to particular implementations of it.

§Original

slice::SliceIndex

§API Differences

The SliceIndex::Output type is not usable here, because bitvec cannot manifest a &mut bool reference. Work to unify referential values in the trait system is ongoing, and in the future this functionality may be approximated.

Instead, this uses two output types, Immut and Mut, that are the referential structures produced by indexing immutably or mutably, respectively. This allows the range implementations to produce &/mut BitSlice as expected, while usize produces the proxy structure.

Required Associated Types§

type Immut

The output type of immutable access.

type Mut

The output type of mutable access.

Required Methods§

fn get(self, bits: &'a BitSlice<T, O>) -> Option<Self::Immut>

Immutably indexes into a bit-slice, returning None if self is out of bounds.

§Original

SliceIndex::get

fn get_mut(self, bits: &'a mut BitSlice<T, O>) -> Option<Self::Mut>

Mutably indexes into a bit-slice, returning None if self is out of bounds.

§Original

SliceIndex::get_mut

unsafe fn get_unchecked(self, bits: &'a BitSlice<T, O>) -> Self::Immut

Immutably indexes into a bit-slice without doing any bounds checking.

§Original

SliceIndex::get_unchecked

§Safety

If self is not in bounds, then memory accesses through it are illegal and the program becomes undefined. You must ensure that self is appropriately within 0 .. bits.len() at the call site.

unsafe fn get_unchecked_mut(self, bits: &'a mut BitSlice<T, O>) -> Self::Mut

Mutably indexes into a bit-slice without doing any bounds checking.

§Original

SliceIndex::get_unchecked_mut

§Safety

If self is not in bounds, then memory accesses through it bare illegal and the program becomes undefined. You must ensure that self is appropriately within 0 .. bits.len() at the call site.

fn index(self, bits: &'a BitSlice<T, O>) -> Self::Immut

Immutably indexes into a bit-slice, panicking if self is out of bounds.

§Original

SliceIndex::index

§Panics

Implementations are required to panic if self exceeds bits.len() in any way.

fn index_mut(self, bits: &'a mut BitSlice<T, O>) -> Self::Mut

Mutably indexes into a bit-slice, panicking if self is out of bounds.

§Original

SliceIndex::index_mut

§Panics

Implementations are required to panic if self exceeds bits.len() in any way.

Implementations on Foreign Types§

§

impl<'a, T, O> BitSliceIndex<'a, T, O> for usize
where T: BitStore, O: BitOrder,

§

type Immut = BitRef<'a, Const, T, O>

§

type Mut = BitRef<'a, Mut, T, O>

§

fn get( self, bits: &'a BitSlice<T, O>, ) -> Option<<usize as BitSliceIndex<'a, T, O>>::Immut>

§

fn get_mut( self, bits: &'a mut BitSlice<T, O>, ) -> Option<<usize as BitSliceIndex<'a, T, O>>::Mut>

§

unsafe fn get_unchecked( self, bits: &'a BitSlice<T, O>, ) -> <usize as BitSliceIndex<'a, T, O>>::Immut

§

unsafe fn get_unchecked_mut( self, bits: &'a mut BitSlice<T, O>, ) -> <usize as BitSliceIndex<'a, T, O>>::Mut

§

fn index( self, bits: &'a BitSlice<T, O>, ) -> <usize as BitSliceIndex<'a, T, O>>::Immut

§

fn index_mut( self, bits: &'a mut BitSlice<T, O>, ) -> <usize as BitSliceIndex<'a, T, O>>::Mut

§

impl<'a, T, O> BitSliceIndex<'a, T, O> for Range<usize>
where O: BitOrder, T: BitStore,

§

type Immut = &'a BitSlice<T, O>

§

type Mut = &'a mut BitSlice<T, O>

§

fn get( self, bits: <Range<usize> as BitSliceIndex<'a, T, O>>::Immut, ) -> Option<<Range<usize> as BitSliceIndex<'a, T, O>>::Immut>

§

fn get_mut( self, bits: <Range<usize> as BitSliceIndex<'a, T, O>>::Mut, ) -> Option<<Range<usize> as BitSliceIndex<'a, T, O>>::Mut>

§

unsafe fn get_unchecked( self, bits: <Range<usize> as BitSliceIndex<'a, T, O>>::Immut, ) -> <Range<usize> as BitSliceIndex<'a, T, O>>::Immut

§

unsafe fn get_unchecked_mut( self, bits: <Range<usize> as BitSliceIndex<'a, T, O>>::Mut, ) -> <Range<usize> as BitSliceIndex<'a, T, O>>::Mut

§

fn index( self, bits: <Range<usize> as BitSliceIndex<'a, T, O>>::Immut, ) -> <Range<usize> as BitSliceIndex<'a, T, O>>::Immut

§

fn index_mut( self, bits: <Range<usize> as BitSliceIndex<'a, T, O>>::Mut, ) -> <Range<usize> as BitSliceIndex<'a, T, O>>::Mut

§

impl<'a, T, O> BitSliceIndex<'a, T, O> for RangeFrom<usize>
where O: BitOrder, T: BitStore,

§

type Immut = &'a BitSlice<T, O>

§

type Mut = &'a mut BitSlice<T, O>

§

fn get( self, bits: <RangeFrom<usize> as BitSliceIndex<'a, T, O>>::Immut, ) -> Option<<RangeFrom<usize> as BitSliceIndex<'a, T, O>>::Immut>

§

fn get_mut( self, bits: <RangeFrom<usize> as BitSliceIndex<'a, T, O>>::Mut, ) -> Option<<RangeFrom<usize> as BitSliceIndex<'a, T, O>>::Mut>

§

unsafe fn get_unchecked( self, bits: <RangeFrom<usize> as BitSliceIndex<'a, T, O>>::Immut, ) -> <RangeFrom<usize> as BitSliceIndex<'a, T, O>>::Immut

§

unsafe fn get_unchecked_mut( self, bits: <RangeFrom<usize> as BitSliceIndex<'a, T, O>>::Mut, ) -> <RangeFrom<usize> as BitSliceIndex<'a, T, O>>::Mut

§

fn index( self, bits: <RangeFrom<usize> as BitSliceIndex<'a, T, O>>::Immut, ) -> <RangeFrom<usize> as BitSliceIndex<'a, T, O>>::Immut

§

fn index_mut( self, bits: <RangeFrom<usize> as BitSliceIndex<'a, T, O>>::Mut, ) -> <RangeFrom<usize> as BitSliceIndex<'a, T, O>>::Mut

§

impl<'a, T, O> BitSliceIndex<'a, T, O> for RangeFull
where T: BitStore, O: BitOrder,

Available on non-tarpaulin_include only.
§

type Immut = &'a BitSlice<T, O>

§

type Mut = &'a mut BitSlice<T, O>

§

fn get( self, bits: <RangeFull as BitSliceIndex<'a, T, O>>::Immut, ) -> Option<<RangeFull as BitSliceIndex<'a, T, O>>::Immut>

§

fn get_mut( self, bits: <RangeFull as BitSliceIndex<'a, T, O>>::Mut, ) -> Option<<RangeFull as BitSliceIndex<'a, T, O>>::Mut>

§

unsafe fn get_unchecked( self, bits: <RangeFull as BitSliceIndex<'a, T, O>>::Immut, ) -> <RangeFull as BitSliceIndex<'a, T, O>>::Immut

§

unsafe fn get_unchecked_mut( self, bits: <RangeFull as BitSliceIndex<'a, T, O>>::Mut, ) -> <RangeFull as BitSliceIndex<'a, T, O>>::Mut

§

fn index( self, bits: <RangeFull as BitSliceIndex<'a, T, O>>::Immut, ) -> <RangeFull as BitSliceIndex<'a, T, O>>::Immut

§

fn index_mut( self, bits: <RangeFull as BitSliceIndex<'a, T, O>>::Mut, ) -> <RangeFull as BitSliceIndex<'a, T, O>>::Mut

§

impl<'a, T, O> BitSliceIndex<'a, T, O> for RangeInclusive<usize>
where O: BitOrder, T: BitStore,

§

type Immut = &'a BitSlice<T, O>

§

type Mut = &'a mut BitSlice<T, O>

§

fn get( self, bits: <RangeInclusive<usize> as BitSliceIndex<'a, T, O>>::Immut, ) -> Option<<RangeInclusive<usize> as BitSliceIndex<'a, T, O>>::Immut>

§

fn get_mut( self, bits: <RangeInclusive<usize> as BitSliceIndex<'a, T, O>>::Mut, ) -> Option<<RangeInclusive<usize> as BitSliceIndex<'a, T, O>>::Mut>

§

unsafe fn get_unchecked( self, bits: <RangeInclusive<usize> as BitSliceIndex<'a, T, O>>::Immut, ) -> <RangeInclusive<usize> as BitSliceIndex<'a, T, O>>::Immut

§

unsafe fn get_unchecked_mut( self, bits: <RangeInclusive<usize> as BitSliceIndex<'a, T, O>>::Mut, ) -> <RangeInclusive<usize> as BitSliceIndex<'a, T, O>>::Mut

§

fn index( self, bits: <RangeInclusive<usize> as BitSliceIndex<'a, T, O>>::Immut, ) -> <RangeInclusive<usize> as BitSliceIndex<'a, T, O>>::Immut

§

fn index_mut( self, bits: <RangeInclusive<usize> as BitSliceIndex<'a, T, O>>::Mut, ) -> <RangeInclusive<usize> as BitSliceIndex<'a, T, O>>::Mut

§

impl<'a, T, O> BitSliceIndex<'a, T, O> for RangeTo<usize>
where O: BitOrder, T: BitStore,

§

type Immut = &'a BitSlice<T, O>

§

type Mut = &'a mut BitSlice<T, O>

§

fn get( self, bits: <RangeTo<usize> as BitSliceIndex<'a, T, O>>::Immut, ) -> Option<<RangeTo<usize> as BitSliceIndex<'a, T, O>>::Immut>

§

fn get_mut( self, bits: <RangeTo<usize> as BitSliceIndex<'a, T, O>>::Mut, ) -> Option<<RangeTo<usize> as BitSliceIndex<'a, T, O>>::Mut>

§

unsafe fn get_unchecked( self, bits: <RangeTo<usize> as BitSliceIndex<'a, T, O>>::Immut, ) -> <RangeTo<usize> as BitSliceIndex<'a, T, O>>::Immut

§

unsafe fn get_unchecked_mut( self, bits: <RangeTo<usize> as BitSliceIndex<'a, T, O>>::Mut, ) -> <RangeTo<usize> as BitSliceIndex<'a, T, O>>::Mut

§

fn index( self, bits: <RangeTo<usize> as BitSliceIndex<'a, T, O>>::Immut, ) -> <RangeTo<usize> as BitSliceIndex<'a, T, O>>::Immut

§

fn index_mut( self, bits: <RangeTo<usize> as BitSliceIndex<'a, T, O>>::Mut, ) -> <RangeTo<usize> as BitSliceIndex<'a, T, O>>::Mut

§

impl<'a, T, O> BitSliceIndex<'a, T, O> for RangeToInclusive<usize>
where O: BitOrder, T: BitStore,

§

type Immut = &'a BitSlice<T, O>

§

type Mut = &'a mut BitSlice<T, O>

§

fn get( self, bits: <RangeToInclusive<usize> as BitSliceIndex<'a, T, O>>::Immut, ) -> Option<<RangeToInclusive<usize> as BitSliceIndex<'a, T, O>>::Immut>

§

fn get_mut( self, bits: <RangeToInclusive<usize> as BitSliceIndex<'a, T, O>>::Mut, ) -> Option<<RangeToInclusive<usize> as BitSliceIndex<'a, T, O>>::Mut>

§

unsafe fn get_unchecked( self, bits: <RangeToInclusive<usize> as BitSliceIndex<'a, T, O>>::Immut, ) -> <RangeToInclusive<usize> as BitSliceIndex<'a, T, O>>::Immut

§

unsafe fn get_unchecked_mut( self, bits: <RangeToInclusive<usize> as BitSliceIndex<'a, T, O>>::Mut, ) -> <RangeToInclusive<usize> as BitSliceIndex<'a, T, O>>::Mut

§

fn index( self, bits: <RangeToInclusive<usize> as BitSliceIndex<'a, T, O>>::Immut, ) -> <RangeToInclusive<usize> as BitSliceIndex<'a, T, O>>::Immut

§

fn index_mut( self, bits: <RangeToInclusive<usize> as BitSliceIndex<'a, T, O>>::Mut, ) -> <RangeToInclusive<usize> as BitSliceIndex<'a, T, O>>::Mut

Implementors§