Trait slice_of_array::SliceNestExt [−][src]
pub trait SliceNestExt<T> { fn nest<V: IsSliceomorphic<Element = T>>(&self) -> &[V]; fn nest_mut<V: IsSliceomorphic<Element = T>>(&mut self) -> &mut [V]; }
Permits viewing a slice as a slice of arrays.
The new array dimension can often be inferred.
When it is not, a turbofish can be used: .nest::<[_; 3]>()
.
Panics
All methods panic if the input length is not divisible by n
.
Implementors
The methods are available on &[T]
and &mut [T]
for all T
.
Of course, they are also available on Vec<T>
and any other type
that derefs or unsizes to [T]
.
Notice
The existence of this trait is an implementation detail.
Please do NOT use this trait as a generic bound in your code.
Required methods
fn nest<V: IsSliceomorphic<Element = T>>(&self) -> &[V]
[src]
View &[T]
as &[[T; n]]
without copying.
fn nest_mut<V: IsSliceomorphic<Element = T>>(&mut self) -> &mut [V]
[src]
View &mut [T]
as &mut [[T; n]]
without copying.
Implementations on Foreign Types
impl<T> SliceNestExt<T> for [T]
[src]
impl<T> SliceNestExt<T> for [T]
[src]