[−][src]Trait bitvec::slice::BitSliceIndex
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 ImmutOutput
Immutable output type.
type MutOutput
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<C, T>) -> Option<Self::ImmutOutput>
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<C, T>) -> Option<Self::MutOutput>
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<C, T>) -> Self::ImmutOutput
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<C, T>
) -> Self::MutOutput
self,
slice: &'a mut BitSlice<C, T>
) -> Self::MutOutput
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<C, T>) -> Self::ImmutOutput
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<C, T>) -> Self::MutOutput
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, C, T> BitSliceIndex<'a, C, T> for usize where
C: 'a + Cursor,
T: 'a + BitStore,
[src]
C: 'a + Cursor,
T: 'a + BitStore,
type ImmutOutput = &'a bool
type MutOutput = BitMut<'a, C, T>
fn get(self, slice: &'a BitSlice<C, T>) -> Option<Self::ImmutOutput>
[src]
fn get_mut(self, slice: &'a mut BitSlice<C, T>) -> Option<Self::MutOutput>
[src]
unsafe fn get_unchecked(self, slice: &'a BitSlice<C, T>) -> Self::ImmutOutput
[src]
unsafe fn get_unchecked_mut(
self,
slice: &'a mut BitSlice<C, T>
) -> Self::MutOutput
[src]
self,
slice: &'a mut BitSlice<C, T>
) -> Self::MutOutput
fn index(self, slice: &'a BitSlice<C, T>) -> Self::ImmutOutput
[src]
fn index_mut(self, slice: &'a mut BitSlice<C, T>) -> Self::MutOutput
[src]
impl<'a, C, T> BitSliceIndex<'a, C, T> for Range<usize> where
C: 'a + Cursor,
T: 'a + BitStore,
[src]
C: 'a + Cursor,
T: 'a + BitStore,
type ImmutOutput = &'a BitSlice<C, T>
type MutOutput = &'a mut BitSlice<C, T>
fn get(self, slice: &'a BitSlice<C, T>) -> Option<Self::ImmutOutput>
[src]
fn get_mut(self, slice: &'a mut BitSlice<C, T>) -> Option<Self::MutOutput>
[src]
unsafe fn get_unchecked(self, slice: &'a BitSlice<C, T>) -> Self::ImmutOutput
[src]
unsafe fn get_unchecked_mut(
self,
slice: &'a mut BitSlice<C, T>
) -> Self::MutOutput
[src]
self,
slice: &'a mut BitSlice<C, T>
) -> Self::MutOutput
fn index(self, slice: &'a BitSlice<C, T>) -> Self::ImmutOutput
[src]
fn index_mut(self, slice: &'a mut BitSlice<C, T>) -> Self::MutOutput
[src]
impl<'a, C, T> BitSliceIndex<'a, C, T> for RangeInclusive<usize> where
C: 'a + Cursor,
T: 'a + BitStore,
[src]
C: 'a + Cursor,
T: 'a + BitStore,
type ImmutOutput = &'a BitSlice<C, T>
type MutOutput = &'a mut BitSlice<C, T>
fn get(self, slice: &'a BitSlice<C, T>) -> Option<Self::ImmutOutput>
[src]
fn get_mut(self, slice: &'a mut BitSlice<C, T>) -> Option<Self::MutOutput>
[src]
unsafe fn get_unchecked(self, slice: &'a BitSlice<C, T>) -> Self::ImmutOutput
[src]
unsafe fn get_unchecked_mut(
self,
slice: &'a mut BitSlice<C, T>
) -> Self::MutOutput
[src]
self,
slice: &'a mut BitSlice<C, T>
) -> Self::MutOutput
fn index(self, slice: &'a BitSlice<C, T>) -> Self::ImmutOutput
[src]
fn index_mut(self, slice: &'a mut BitSlice<C, T>) -> Self::MutOutput
[src]
impl<'a, C, T> BitSliceIndex<'a, C, T> for RangeFrom<usize> where
C: 'a + Cursor,
T: 'a + BitStore,
[src]
C: 'a + Cursor,
T: 'a + BitStore,
type ImmutOutput = &'a BitSlice<C, T>
type MutOutput = &'a mut BitSlice<C, T>
fn get(self, slice: &'a BitSlice<C, T>) -> Option<Self::ImmutOutput>
[src]
fn get_mut(self, slice: &'a mut BitSlice<C, T>) -> Option<Self::MutOutput>
[src]
unsafe fn get_unchecked(self, slice: &'a BitSlice<C, T>) -> Self::ImmutOutput
[src]
unsafe fn get_unchecked_mut(
self,
slice: &'a mut BitSlice<C, T>
) -> Self::MutOutput
[src]
self,
slice: &'a mut BitSlice<C, T>
) -> Self::MutOutput
fn index(self, slice: &'a BitSlice<C, T>) -> Self::ImmutOutput
[src]
fn index_mut(self, slice: &'a mut BitSlice<C, T>) -> Self::MutOutput
[src]
impl<'a, C, T> BitSliceIndex<'a, C, T> for RangeFull where
C: 'a + Cursor,
T: 'a + BitStore,
[src]
C: 'a + Cursor,
T: 'a + BitStore,
type ImmutOutput = &'a BitSlice<C, T>
type MutOutput = &'a mut BitSlice<C, T>
fn get(self, slice: &'a BitSlice<C, T>) -> Option<Self::ImmutOutput>
[src]
fn get_mut(self, slice: &'a mut BitSlice<C, T>) -> Option<Self::MutOutput>
[src]
unsafe fn get_unchecked(self, slice: &'a BitSlice<C, T>) -> Self::ImmutOutput
[src]
unsafe fn get_unchecked_mut(
self,
slice: &'a mut BitSlice<C, T>
) -> Self::MutOutput
[src]
self,
slice: &'a mut BitSlice<C, T>
) -> Self::MutOutput
fn index(self, slice: &'a BitSlice<C, T>) -> Self::ImmutOutput
[src]
fn index_mut(self, slice: &'a mut BitSlice<C, T>) -> Self::MutOutput
[src]
impl<'a, C, T> BitSliceIndex<'a, C, T> for RangeTo<usize> where
C: 'a + Cursor,
T: 'a + BitStore,
[src]
C: 'a + Cursor,
T: 'a + BitStore,
type ImmutOutput = &'a BitSlice<C, T>
type MutOutput = &'a mut BitSlice<C, T>
fn get(self, slice: &'a BitSlice<C, T>) -> Option<Self::ImmutOutput>
[src]
fn get_mut(self, slice: &'a mut BitSlice<C, T>) -> Option<Self::MutOutput>
[src]
unsafe fn get_unchecked(self, slice: &'a BitSlice<C, T>) -> Self::ImmutOutput
[src]
unsafe fn get_unchecked_mut(
self,
slice: &'a mut BitSlice<C, T>
) -> Self::MutOutput
[src]
self,
slice: &'a mut BitSlice<C, T>
) -> Self::MutOutput
fn index(self, slice: &'a BitSlice<C, T>) -> Self::ImmutOutput
[src]
fn index_mut(self, slice: &'a mut BitSlice<C, T>) -> Self::MutOutput
[src]
impl<'a, C, T> BitSliceIndex<'a, C, T> for RangeToInclusive<usize> where
C: 'a + Cursor,
T: 'a + BitStore,
[src]
C: 'a + Cursor,
T: 'a + BitStore,
type ImmutOutput = &'a BitSlice<C, T>
type MutOutput = &'a mut BitSlice<C, T>
fn get(self, slice: &'a BitSlice<C, T>) -> Option<Self::ImmutOutput>
[src]
fn get_mut(self, slice: &'a mut BitSlice<C, T>) -> Option<Self::MutOutput>
[src]
unsafe fn get_unchecked(self, slice: &'a BitSlice<C, T>) -> Self::ImmutOutput
[src]
unsafe fn get_unchecked_mut(
self,
slice: &'a mut BitSlice<C, T>
) -> Self::MutOutput
[src]
self,
slice: &'a mut BitSlice<C, T>
) -> Self::MutOutput