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

A helper trait used for indexing operations.

This trait has its definition stabilized, but has not stabilized its associated methods. This means it cannot be implemented outside of the distribution libraries. Furthermore, since bitvec cannot create &mut bool references, it is insufficient for bitvec’s uses.

There is no tracking issue for feature(slice_index_methods).

Original

slice::SliceIndex

API Differences

SliceIndex::Output is not usable here, because the usize implementation cannot produce &mut bool. Instead, two output types Immut and Mut are defined. The range implementations define these to be the appropriately mutable BitSlice reference; the usize implementation defines them to be &bool and the proxy type.

Associated Types

The output type for immutable accessors.

The output type for mutable accessors.

Required methods

Returns a shared reference to the output at this location, if in bounds.

Original

SliceIndex::get

Returns a mutable reference to the output at this location, if in bounds.

Original

SliceIndex::get_mut

Returns a shared reference to the output at this location, without performing any bounds checking. Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.

Original

SliceIndex::get_unchecked

Safety

As this function does not perform boundary checking, the caller must ensure that self is an index within the boundaries of slice before calling in order to prevent boundary escapes and the ensuing safety violations.

Returns a mutable reference to the output at this location, without performing any bounds checking. Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.

Original

SliceIndex::get_unchecked_mut

Safety

As this function does not perform boundary checking, the caller must ensure that self is an index within the boundaries of slice before calling in order to prevent boundary escapes and the ensuing safety violations.

Returns a shared reference to the output at this location, panicking if out of bounds.

Original

SliceIndex::index

Returns a mutable reference to the output at this location, panicking if out of bounds.

Original

SliceIndex::index_mut

Implementations on Foreign Types

RangeFull is the identity function.

Implementors