pub struct SliceGroup<'a, E: Entity, T: 'a = <E as Entity>::Unit>(/* private fields */);
Expand description
Analogous to an immutable reference to a slice for groups.
Implementations§
Source§impl<'a, E: Entity, T> SliceGroup<'a, E, T>
impl<'a, E: Entity, T> SliceGroup<'a, E, T>
Sourcepub fn new(slice: GroupFor<E, &'a [T]>) -> Self
pub fn new(slice: GroupFor<E, &'a [T]>) -> Self
Create a new SliceGroup
from a group of slice references.
Sourcepub fn into_inner(self) -> GroupFor<E, &'a [T]>
pub fn into_inner(self) -> GroupFor<E, &'a [T]>
Consume self
to return the internally stored group of slice references.
Sourcepub fn as_arrays<const N: usize>(
self,
) -> (SliceGroup<'a, E, [T; N]>, SliceGroup<'a, E, T>)
pub fn as_arrays<const N: usize>( self, ) -> (SliceGroup<'a, E, [T; N]>, SliceGroup<'a, E, T>)
Decompose self
into a slice of arrays of size N
, and a remainder part with length
< N
.
Source§impl<'a, E: Entity> SliceGroup<'a, E>
impl<'a, E: Entity> SliceGroup<'a, E>
Source§impl<'a, E: Entity, T> SliceGroup<'a, E, T>
impl<'a, E: Entity, T> SliceGroup<'a, E, T>
Sourcepub fn get(self, idx: usize) -> RefGroup<'a, E, T>
pub fn get(self, idx: usize) -> RefGroup<'a, E, T>
Get a RefGroup
pointing to the element at position idx
.
Sourcepub unsafe fn get_unchecked(self, idx: usize) -> RefGroup<'a, E, T>
pub unsafe fn get_unchecked(self, idx: usize) -> RefGroup<'a, E, T>
Sourcepub fn subslice(self, range: Range<usize>) -> Self
pub fn subslice(self, range: Range<usize>) -> Self
Returns the subslice of self
from the start to the end of the provided range.
Sourcepub fn split_at(self, idx: usize) -> (Self, Self)
pub fn split_at(self, idx: usize) -> (Self, Self)
Split self
at the midpoint idx
, and return the two parts.
Sourcepub unsafe fn subslice_unchecked(self, range: Range<usize>) -> Self
pub unsafe fn subslice_unchecked(self, range: Range<usize>) -> Self
Returns the subslice of self
from the start to the end of the provided range, without
bound checks.
§Safety
The behavior is undefined if range.start > range.end
or range.end > self.len()
.
Sourcepub fn into_ref_iter(self) -> impl Iterator<Item = RefGroup<'a, E, T>>
pub fn into_ref_iter(self) -> impl Iterator<Item = RefGroup<'a, E, T>>
Returns an iterator of RefGroup
over the elements of the slice.
Sourcepub fn into_chunks_exact(
self,
chunk_size: usize,
) -> (impl Iterator<Item = SliceGroup<'a, E, T>>, Self)
pub fn into_chunks_exact( self, chunk_size: usize, ) -> (impl Iterator<Item = SliceGroup<'a, E, T>>, Self)
Returns an iterator of slices over chunks of size chunk_size
, and the remainder of
the slice.
Trait Implementations§
Source§impl<E: Entity, T> Clone for SliceGroup<'_, E, T>
impl<E: Entity, T> Clone for SliceGroup<'_, E, T>
Source§impl<'a, E: Entity, T> IntoConst for SliceGroup<'a, E, T>
impl<'a, E: Entity, T> IntoConst for SliceGroup<'a, E, T>
type Target = SliceGroup<'a, E, T>
fn into_const(self) -> Self::Target
Source§impl<'short, 'a, E: Entity, T> Reborrow<'short> for SliceGroup<'a, E, T>
impl<'short, 'a, E: Entity, T> Reborrow<'short> for SliceGroup<'a, E, T>
Source§impl<'short, 'a, E: Entity, T> ReborrowMut<'short> for SliceGroup<'a, E, T>
impl<'short, 'a, E: Entity, T> ReborrowMut<'short> for SliceGroup<'a, E, T>
impl<E: Entity, T> Copy for SliceGroup<'_, E, T>
impl<E: Entity, T: Sync> Send for SliceGroup<'_, E, T>
impl<E: Entity, T: Sync> Sync for SliceGroup<'_, E, T>
Auto Trait Implementations§
impl<'a, E, T> Freeze for SliceGroup<'a, E, T>
impl<'a, E, T> RefUnwindSafe for SliceGroup<'a, E, T>
impl<'a, E, T> Unpin for SliceGroup<'a, E, T>
impl<'a, E, T> UnwindSafe for SliceGroup<'a, E, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more