pub struct SliceWrapper<'a, I, T>(/* private fields */);
Expand description
Wrapper around slice references to add support for the static index types.
Due to language weirdness, we can’t implement Index
and IndexMut
with static indexes for both [T]
and [T; N]
. As a result, we need this
wrapper type.
For convenience, SliceWrapper
also implements Deref
and DerefMut
.
This allows SliceWrapper
instances to be converted to &[T]
, in addition to
allowing all the underlying functions of T
to be used.
Implementations§
Trait Implementations§
Source§impl<'a, I, T> Deref for SliceWrapper<'a, I, T>
impl<'a, I, T> Deref for SliceWrapper<'a, I, T>
Source§impl<'a, I, T> DerefMut for SliceWrapper<'a, I, T>
impl<'a, I, T> DerefMut for SliceWrapper<'a, I, T>
Source§impl<I, S: AsRef<[I]>, const INDEX: usize> Index<StaticIndex<INDEX>> for SliceWrapper<'_, I, S>
impl<I, S: AsRef<[I]>, const INDEX: usize> Index<StaticIndex<INDEX>> for SliceWrapper<'_, I, S>
Source§impl<I, S: AsRef<[I]>, const START: usize, const LENGTH: usize> Index<StaticRangeIndex<START, LENGTH>> for SliceWrapper<'_, I, S>
impl<I, S: AsRef<[I]>, const START: usize, const LENGTH: usize> Index<StaticRangeIndex<START, LENGTH>> for SliceWrapper<'_, I, S>
Source§type Output = [I; LENGTH]
type Output = [I; LENGTH]
The returned type after indexing.
Source§impl<I, S: AsRef<[I]> + AsMut<[I]>, const INDEX: usize> IndexMut<StaticIndex<INDEX>> for SliceWrapper<'_, I, S>
impl<I, S: AsRef<[I]> + AsMut<[I]>, const INDEX: usize> IndexMut<StaticIndex<INDEX>> for SliceWrapper<'_, I, S>
Auto Trait Implementations§
impl<'a, I, T> Freeze for SliceWrapper<'a, I, T>where
T: Freeze,
impl<'a, I, T> RefUnwindSafe for SliceWrapper<'a, I, T>where
T: RefUnwindSafe,
I: RefUnwindSafe,
impl<'a, I, T> Send for SliceWrapper<'a, I, T>
impl<'a, I, T> Sync for SliceWrapper<'a, I, T>
impl<'a, I, T> Unpin for SliceWrapper<'a, I, T>
impl<'a, I, T> UnwindSafe for SliceWrapper<'a, I, T>where
T: UnwindSafe,
I: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more