Trait bitvec::slice::BitSliceIndex[][src]

pub trait BitSliceIndex<'a, O, T> where
    O: 'a + BitOrder,
    T: 'a + 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; }

A helper trait used for indexing operations.

This trait has its definition stabilized, but has not stabilized its associated functions. 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

type Immut[src]

The output type for immutable functions.

type Mut[src]

The output type for mutable functions.

Loading content...

Required methods

fn get(self, slice: &'a BitSlice<O, T>) -> Option<Self::Immut>[src]

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

Original

SliceIndex::get

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

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

Original

SliceIndex::get_mut

unsafe fn get_unchecked(self, slice: &'a BitSlice<O, T>) -> Self::Immut[src]

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.

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

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.

fn index(self, slice: &'a BitSlice<O, T>) -> Self::Immut[src]

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

Original

SliceIndex::index

fn index_mut(self, slice: &'a mut BitSlice<O, T>) -> Self::Mut[src]

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

Original

SliceIndex::index_mut

Loading content...

Implementations on Foreign Types

impl<'a, O, T> BitSliceIndex<'a, O, T> for usize where
    O: 'a + BitOrder,
    T: 'a + BitStore
[src]

type Immut = &'a bool

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

impl<'a, O, T> BitSliceIndex<'a, O, T> for RangeFull where
    O: 'a + BitOrder,
    T: 'a + BitStore
[src]

RangeFull is the identity function.

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

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

Loading content...

Implementors

Loading content...