Trait bitvec::slice::BitSliceIndex [−][src]
Replacement for slice::SliceIndex
.
This trait is stabilized in definition and type Output
only, but all methods
are unstable. This makes it unusable in non-libstd
slice libraries, and so it
must be duplicated here.
There is no tracking issue for feature(slice_index_methods)
.
Associated Types
type Immut
[src]
Immutable output type.
type Mut
[src]
Mutable output type. This is necessary because &mut BitSlice
is
producible for range indices, but &mut bool
is not producable for
usize
indices.
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.
Parameters
self
: The index value.slice
: The slice under index.
Returns
An immutable output, if self
is in bounds; otherwise None
.
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.
Parameters
self
: The index value.slice
: The slice under index.
Returns
A mutable output, if self
is in bounds; otherwise None
.
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.
Parameters
self
: The index value.slice
: The slice under index.
Returns
An immutable output.
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 avoid boundary escapes and 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.
Parameters
self
: The index value.slice
: The slice under index.
Returns
A mutable output.
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 avoid boundary escapes and 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.
Parameters
self
: The index value.slice
: The slice under index.
Returns
An immutable output.
Panics
This panics if self
is out of bounds of slice
.
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.
Parameters
self
: The index value.slice
: The slice under index.
Returns
A mutable output.
Panics
This panics if self
is out of bounds of slice
.
Implementations on Foreign Types
impl<'a, O, T> BitSliceIndex<'a, O, T> for usize where
O: 'a + BitOrder,
T: 'a + BitStore,
[src]
O: 'a + BitOrder,
T: 'a + BitStore,
type Immut = &'a bool
type Mut = BitMut<'a, O, T>
fn get(self, slice: &'a BitSlice<O, T>) -> Option<Self::Immut>
[src]
fn get_mut(self, slice: &'a mut BitSlice<O, T>) -> Option<Self::Mut>
[src]
unsafe fn get_unchecked(self, slice: &'a BitSlice<O, T>) -> Self::Immut
[src]
unsafe fn get_unchecked_mut(self, slice: &'a mut BitSlice<O, T>) -> Self::Mut
[src]
fn index(self, slice: &'a BitSlice<O, T>) -> Self::Immut
[src]
fn index_mut(self, slice: &'a mut BitSlice<O, T>) -> Self::Mut
[src]
impl<'a, O, T> BitSliceIndex<'a, O, T> for Range<usize> where
O: 'a + BitOrder,
T: 'a + BitStore,
[src]
O: 'a + BitOrder,
T: 'a + BitStore,
type Immut = &'a BitSlice<O, T>
type Mut = &'a mut BitSlice<O, T>
fn get(self, slice: Self::Immut) -> Option<Self::Immut>
[src]
fn get_mut(self, slice: Self::Mut) -> Option<Self::Mut>
[src]
unsafe fn get_unchecked(self, slice: Self::Immut) -> Self::Immut
[src]
unsafe fn get_unchecked_mut(self, slice: Self::Mut) -> Self::Mut
[src]
fn index(self, slice: Self::Immut) -> Self::Immut
[src]
fn index_mut(self, slice: Self::Mut) -> Self::Mut
[src]
impl<'a, O, T> BitSliceIndex<'a, O, T> for RangeFrom<usize> where
O: 'a + BitOrder,
T: 'a + BitStore,
[src]
O: 'a + BitOrder,
T: 'a + BitStore,
type Immut = &'a BitSlice<O, T>
type Mut = &'a mut BitSlice<O, T>
fn get(self, slice: Self::Immut) -> Option<Self::Immut>
[src]
fn get_mut(self, slice: Self::Mut) -> Option<Self::Mut>
[src]
unsafe fn get_unchecked(self, slice: Self::Immut) -> Self::Immut
[src]
unsafe fn get_unchecked_mut(self, slice: Self::Mut) -> Self::Mut
[src]
fn index(self, slice: Self::Immut) -> Self::Immut
[src]
fn index_mut(self, slice: Self::Mut) -> Self::Mut
[src]
impl<'a, O, T> BitSliceIndex<'a, O, T> for RangeTo<usize> where
O: 'a + BitOrder,
T: 'a + BitStore,
[src]
O: 'a + BitOrder,
T: 'a + BitStore,
type Immut = &'a BitSlice<O, T>
type Mut = &'a mut BitSlice<O, T>
fn get(self, slice: Self::Immut) -> Option<Self::Immut>
[src]
fn get_mut(self, slice: Self::Mut) -> Option<Self::Mut>
[src]
unsafe fn get_unchecked(self, slice: Self::Immut) -> Self::Immut
[src]
unsafe fn get_unchecked_mut(self, slice: Self::Mut) -> Self::Mut
[src]
fn index(self, slice: Self::Immut) -> Self::Immut
[src]
fn index_mut(self, slice: Self::Mut) -> Self::Mut
[src]
impl<'a, O, T> BitSliceIndex<'a, O, T> for RangeInclusive<usize> where
O: 'a + BitOrder,
T: 'a + BitStore,
[src]
O: 'a + BitOrder,
T: 'a + BitStore,
type Immut = &'a BitSlice<O, T>
type Mut = &'a mut BitSlice<O, T>
fn get(self, slice: Self::Immut) -> Option<Self::Immut>
[src]
fn get_mut(self, slice: Self::Mut) -> Option<Self::Mut>
[src]
unsafe fn get_unchecked(self, slice: Self::Immut) -> Self::Immut
[src]
unsafe fn get_unchecked_mut(self, slice: Self::Mut) -> Self::Mut
[src]
fn index(self, slice: Self::Immut) -> Self::Immut
[src]
fn index_mut(self, slice: Self::Mut) -> Self::Mut
[src]
impl<'a, O, T> BitSliceIndex<'a, O, T> for RangeToInclusive<usize> where
O: 'a + BitOrder,
T: 'a + BitStore,
[src]
O: 'a + BitOrder,
T: 'a + BitStore,
type Immut = &'a BitSlice<O, T>
type Mut = &'a mut BitSlice<O, T>
fn get(self, slice: Self::Immut) -> Option<Self::Immut>
[src]
fn get_mut(self, slice: Self::Mut) -> Option<Self::Mut>
[src]
unsafe fn get_unchecked(self, slice: Self::Immut) -> Self::Immut
[src]
unsafe fn get_unchecked_mut(self, slice: Self::Mut) -> Self::Mut
[src]
fn index(self, slice: Self::Immut) -> Self::Immut
[src]
fn index_mut(self, slice: Self::Mut) -> Self::Mut
[src]
impl<'a, O, T> BitSliceIndex<'a, O, T> for RangeFull where
O: 'a + BitOrder,
T: 'a + BitStore,
[src]
O: 'a + BitOrder,
T: 'a + BitStore,
RangeFull
is the identity function.