Struct SliceGroup
pub struct SliceGroup<'a, E, T = <E as Entity>::Unit>(<<E as Entity>::Group as ForCopyType>::FaerOfCopy<*const [T]>, PhantomData<&'a ()>)
where
E: Entity,
T: 'a;
Expand description
Analogous to an immutable reference to a slice for groups.
Tuple Fields§
§0: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<*const [T]>
§1: PhantomData<&'a ()>
Implementations§
§impl<'a, E, T> SliceGroup<'a, E, T>where
E: Entity,
impl<'a, E, T> SliceGroup<'a, E, T>where
E: Entity,
pub fn new(
slice: <<E as Entity>::Group as ForType>::FaerOf<&'a [T]>,
) -> SliceGroup<'a, E, T>
pub fn new( slice: <<E as Entity>::Group as ForType>::FaerOf<&'a [T]>, ) -> SliceGroup<'a, E, T>
Create a new SliceGroup
from a group of slice references.
pub fn into_inner(self) -> <<E as Entity>::Group as ForType>::FaerOf<&'a [T]>
pub fn into_inner(self) -> <<E as Entity>::Group as ForType>::FaerOf<&'a [T]>
Consume self
to return the internally stored group of slice references.
pub 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
.
§impl<'a, E> SliceGroup<'a, E>where
E: Entity,
impl<'a, E> SliceGroup<'a, E>where
E: Entity,
pub unsafe fn read_unchecked(&self, idx: usize) -> E
pub unsafe fn read_unchecked(&self, idx: usize) -> E
Read the element at position idx
, without bound checks.
§Safety
The behavior is undefined if idx >= self.len()
.
§impl<'a, E, T> SliceGroup<'a, E, T>where
E: Entity,
impl<'a, E, T> SliceGroup<'a, E, T>where
E: Entity,
pub 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
.
pub unsafe fn get_unchecked(self, idx: usize) -> RefGroup<'a, E, T>
pub unsafe fn get_unchecked(self, idx: usize) -> RefGroup<'a, E, T>
pub fn subslice(self, range: Range<usize>) -> SliceGroup<'a, E, T>
pub fn subslice(self, range: Range<usize>) -> SliceGroup<'a, E, T>
Returns the subslice of self
from the start to the end of the provided range.
pub fn split_at(
self,
idx: usize,
) -> (SliceGroup<'a, E, T>, SliceGroup<'a, E, T>)
pub fn split_at( self, idx: usize, ) -> (SliceGroup<'a, E, T>, SliceGroup<'a, E, T>)
Split self
at the midpoint idx
, and return the two parts.
pub unsafe fn subslice_unchecked(
self,
range: Range<usize>,
) -> SliceGroup<'a, E, T>
pub unsafe fn subslice_unchecked( self, range: Range<usize>, ) -> SliceGroup<'a, E, T>
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()
.
pub 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.
pub fn into_chunks_exact(
self,
chunk_size: usize,
) -> (impl Iterator<Item = SliceGroup<'a, E, T>>, SliceGroup<'a, E, T>)
pub fn into_chunks_exact( self, chunk_size: usize, ) -> (impl Iterator<Item = SliceGroup<'a, E, T>>, SliceGroup<'a, E, T>)
Returns an iterator of slices over chunks of size chunk_size
, and the remainder of
the slice.
Trait Implementations§
§impl<E, T> Clone for SliceGroup<'_, E, T>where
E: Entity,
impl<E, T> Clone for SliceGroup<'_, E, T>where
E: Entity,
§fn clone(&self) -> SliceGroup<'_, E, T>
fn clone(&self) -> SliceGroup<'_, E, T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<E, T> Debug for SliceGroup<'_, E, T>
impl<E, T> Debug for SliceGroup<'_, E, T>
§impl<'a, E, T> IntoConst for SliceGroup<'a, E, T>where
E: Entity,
impl<'a, E, T> IntoConst for SliceGroup<'a, E, T>where
E: Entity,
type Target = SliceGroup<'a, E, T>
fn into_const(self) -> <SliceGroup<'a, E, T> as IntoConst>::Target
§impl<'short, 'a, E, T> Reborrow<'short> for SliceGroup<'a, E, T>where
E: Entity,
impl<'short, 'a, E, T> Reborrow<'short> for SliceGroup<'a, E, T>where
E: Entity,
type Target = SliceGroup<'short, E, T>
fn rb(&'short self) -> <SliceGroup<'a, E, T> as Reborrow<'short>>::Target
§impl<'short, 'a, E, T> ReborrowMut<'short> for SliceGroup<'a, E, T>where
E: Entity,
impl<'short, 'a, E, T> ReborrowMut<'short> for SliceGroup<'a, E, T>where
E: Entity,
type Target = SliceGroup<'short, E, T>
fn rb_mut( &'short mut self, ) -> <SliceGroup<'a, E, T> as ReborrowMut<'short>>::Target
impl<E, T> Copy for SliceGroup<'_, E, T>where
E: Entity,
impl<E, T> Send for SliceGroup<'_, E, T>
impl<E, T> 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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