pub trait Slices<'a, T>: Clonewhere
T: 'a,{
// Required methods
fn empty() -> Self;
fn num_slices(&self) -> usize;
fn slices(&self) -> impl Iterator<Item = &'a [T]>;
fn lengths(&self) -> impl Iterator<Item = usize>;
fn slice_at(&self, f: usize) -> Option<&'a [T]>;
unsafe fn slice_at_unchecked(&self, f: usize) -> &'a [T];
}
Expand description
A collection of slices.
Required Methods§
Sourcefn num_slices(&self) -> usize
fn num_slices(&self) -> usize
Number of slices.
Sourcefn slice_at(&self, f: usize) -> Option<&'a [T]>
fn slice_at(&self, f: usize) -> Option<&'a [T]>
Returns a reference to the f
-th slice.
Returns None if out of bounds.
Sourceunsafe fn slice_at_unchecked(&self, f: usize) -> &'a [T]
unsafe fn slice_at_unchecked(&self, f: usize) -> &'a [T]
Returns the f
-th slice without bounds checks.
§Safety
The caller must ensure that f < self.num_slices()
.
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.