pub trait SliceByValueSubsliceRange<R: ComposeRange>: for<'a> SliceByValueSubsliceGat<'a> {
// Required method
unsafe fn get_subslice_unchecked(&self, range: R) -> Subslice<'_, Self>;
// Provided methods
fn index_subslice(&self, range: R) -> Subslice<'_, Self> { ... }
fn get_subslice(&self, range: R) -> Option<Subslice<'_, Self>> { ... }
}Expand description
A trait implementing subslicing for a specific range parameter.
The user should never see this trait. SliceByValueSubslice combines all
instances of this trait with R equal to the various kind of standard
ranges (core::ops::Range, core::ops::RangeFull, etc.).
The only method that must be implemented is
get_subslice_unchecked.
Required Methods§
Sourceunsafe fn get_subslice_unchecked(&self, range: R) -> Subslice<'_, Self>
unsafe fn get_subslice_unchecked(&self, range: R) -> Subslice<'_, Self>
See slice::get_unchecked.
For a safe alternative see
get_subslice or
index_subslice.
§Safety
The range must be within bounds.
Provided Methods§
Sourcefn index_subslice(&self, range: R) -> Subslice<'_, Self>
fn index_subslice(&self, range: R) -> Subslice<'_, Self>
Sourcefn get_subslice(&self, range: R) -> Option<Subslice<'_, Self>>
fn get_subslice(&self, range: R) -> Option<Subslice<'_, Self>>
See slice::get.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.