[−][src]Trait utf16string::SliceIndex
Our own version of std::slice::SliceIndex
.
Since this is a sealed trait, we need to re-define this trait. This trait itself is sealed as well.
Associated Types
type Output: ?Sized
The result of slicing, another slice of the same type as you started with normally.
Required methods
fn get(self, slice: &T) -> Option<&Self::Output>
Returns a shared reference to the output at this location, if in bounds.
fn get_mut(self, slice: &mut T) -> Option<&mut Self::Output>
Returns a mutable reference to the output at this location, if in bounds.
unsafe fn get_unchecked(self, slice: &T) -> &Self::Output
Like SliceIndex::get
but without bounds checking.
Safety
You must guarantee the resulting slice is valid UTF-16LE, otherwise you will get undefined behaviour.
unsafe fn get_unchecked_mut(self, slice: &mut T) -> &mut Self::Output
Like SliceIndex::get_mut
but without bounds checking.
Safety
You must guarantee the resulting slice is valid UTF-16LE, otherwise you will get undefined behavour.
fn index(self, slice: &T) -> &Self::Output
Returns a shared reference to the output at this location, panicking if out of bounds.
fn index_mut(self, slice: &mut T) -> &mut Self::Output
Returns a mutable reference to the output at this location, panicking if out of bounds.
Implementations on Foreign Types
impl<E> SliceIndex<WStr<E>> for RangeFull where
E: ByteOrder,
[src]
E: ByteOrder,
Implments substring slicing with syntax &self[..]
or &mut self[..]
.
Unlike other implementations this can never panic.
type Output = WStr<E>
fn get(self, slice: &WStr<E>) -> Option<&Self::Output>
[src]
fn get_mut(self, slice: &mut WStr<E>) -> Option<&mut Self::Output>
[src]
unsafe fn get_unchecked(self, slice: &WStr<E>) -> &Self::Output
[src]
unsafe fn get_unchecked_mut(self, slice: &mut WStr<E>) -> &mut Self::Output
[src]
fn index(self, slice: &WStr<E>) -> &Self::Output
[src]
fn index_mut(self, slice: &mut WStr<E>) -> &mut Self::Output
[src]
impl<E> SliceIndex<WStr<E>> for Range<usize> where
E: ByteOrder,
[src]
E: ByteOrder,
Implements substring slicing with syntax &self[begin .. end]
or &mut self[begin .. end]
.
type Output = WStr<E>
fn get(self, slice: &WStr<E>) -> Option<&Self::Output>
[src]
fn get_mut(self, slice: &mut WStr<E>) -> Option<&mut Self::Output>
[src]
unsafe fn get_unchecked(self, slice: &WStr<E>) -> &Self::Output
[src]
unsafe fn get_unchecked_mut(self, slice: &mut WStr<E>) -> &mut Self::Output
[src]
fn index(self, slice: &WStr<E>) -> &Self::Output
[src]
fn index_mut(self, slice: &mut WStr<E>) -> &mut Self::Output
[src]
impl<E> SliceIndex<WStr<E>> for RangeTo<usize> where
E: ByteOrder,
[src]
E: ByteOrder,
Implements substring slicing with syntax &self[.. end]
or &mut self[.. end]
.
type Output = WStr<E>
fn get(self, slice: &WStr<E>) -> Option<&Self::Output>
[src]
fn get_mut(self, slice: &mut WStr<E>) -> Option<&mut Self::Output>
[src]
unsafe fn get_unchecked(self, slice: &WStr<E>) -> &Self::Output
[src]
unsafe fn get_unchecked_mut(self, slice: &mut WStr<E>) -> &mut Self::Output
[src]
fn index(self, slice: &WStr<E>) -> &Self::Output
[src]
fn index_mut(self, slice: &mut WStr<E>) -> &mut Self::Output
[src]
impl<E> SliceIndex<WStr<E>> for RangeFrom<usize> where
E: ByteOrder,
[src]
E: ByteOrder,
Implements substring slicing with syntax &self[begin ..]
or &mut self[begin ..]
.
type Output = WStr<E>
fn get(self, slice: &WStr<E>) -> Option<&Self::Output>
[src]
fn get_mut(self, slice: &mut WStr<E>) -> Option<&mut Self::Output>
[src]
unsafe fn get_unchecked(self, slice: &WStr<E>) -> &Self::Output
[src]
unsafe fn get_unchecked_mut(self, slice: &mut WStr<E>) -> &mut Self::Output
[src]
fn index(self, slice: &WStr<E>) -> &Self::Output
[src]
fn index_mut(self, slice: &mut WStr<E>) -> &mut Self::Output
[src]
impl<E> SliceIndex<WStr<E>> for RangeInclusive<usize> where
E: ByteOrder,
[src]
E: ByteOrder,
Implements substring slicing with syntax &self[begin ..= end]
or &mut self[begin ..= end]
.
type Output = WStr<E>
fn get(self, slice: &WStr<E>) -> Option<&Self::Output>
[src]
fn get_mut(self, slice: &mut WStr<E>) -> Option<&mut Self::Output>
[src]
unsafe fn get_unchecked(self, slice: &WStr<E>) -> &Self::Output
[src]
unsafe fn get_unchecked_mut(self, slice: &mut WStr<E>) -> &mut Self::Output
[src]
fn index(self, slice: &WStr<E>) -> &Self::Output
[src]
fn index_mut(self, slice: &mut WStr<E>) -> &mut Self::Output
[src]
impl<E> SliceIndex<WStr<E>> for RangeToInclusive<usize> where
E: ByteOrder,
[src]
E: ByteOrder,
Implements substring slicing with syntax &self[..= end]
or &mut self[..= end]
.