[][src]Trait utf16string::SliceIndex

pub trait SliceIndex<T>: SealedSliceIndex where
    T: ?Sized
{ type Output: ?Sized; fn get(self, slice: &T) -> Option<&Self::Output>;
fn get_mut(self, slice: &mut T) -> Option<&mut Self::Output>;
unsafe fn get_unchecked(self, slice: &T) -> &Self::Output;
unsafe fn get_unchecked_mut(self, slice: &mut T) -> &mut Self::Output;
fn index(self, slice: &T) -> &Self::Output;
fn index_mut(self, slice: &mut T) -> &mut Self::Output; }

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.

Loading content...

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.

Loading content...

Implementations on Foreign Types

impl<E> SliceIndex<WStr<E>> for RangeFull where
    E: ByteOrder
[src]

Implments substring slicing with syntax &self[..] or &mut self[..].

Unlike other implementations this can never panic.

type Output = WStr<E>

impl<E> SliceIndex<WStr<E>> for Range<usize> where
    E: ByteOrder
[src]

Implements substring slicing with syntax &self[begin .. end] or &mut self[begin .. end].

type Output = WStr<E>

impl<E> SliceIndex<WStr<E>> for RangeTo<usize> where
    E: ByteOrder
[src]

Implements substring slicing with syntax &self[.. end] or &mut self[.. end].

type Output = WStr<E>

impl<E> SliceIndex<WStr<E>> for RangeFrom<usize> where
    E: ByteOrder
[src]

Implements substring slicing with syntax &self[begin ..] or &mut self[begin ..].

type Output = WStr<E>

impl<E> SliceIndex<WStr<E>> for RangeInclusive<usize> where
    E: ByteOrder
[src]

Implements substring slicing with syntax &self[begin ..= end] or &mut self[begin ..= end].

type Output = WStr<E>

impl<E> SliceIndex<WStr<E>> for RangeToInclusive<usize> where
    E: ByteOrder
[src]

Implements substring slicing with syntax &self[..= end] or &mut self[..= end].

type Output = WStr<E>

Loading content...

Implementors

Loading content...