pub struct CompactSlice<'a, T: CompactRepr> { /* private fields */ }Implementations§
Source§impl<'a, T: CompactRepr> CompactSlice<'a, T>
impl<'a, T: CompactRepr> CompactSlice<'a, T>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn first(&self) -> Option<Compact<T>>
pub fn last(&self) -> Option<Compact<T>>
pub fn split_first(&self) -> Option<(Compact<T>, CompactSlice<'a, T>)>
pub fn split_last(&self) -> Option<(Compact<T>, CompactSlice<'a, T>)>
pub fn split_at(&self, mid: usize) -> (CompactSlice<'a, T>, CompactSlice<'a, T>)
pub fn get(&self, index: usize) -> Option<Compact<T>>
Sourcepub fn count(&self, value: T) -> usize
pub fn count(&self, value: T) -> usize
Count elements equal to value within this slice. Encodes value once
and counts matching packed lanes (1-bit T uses count_ones/
count_zeros).
Sourcepub unsafe fn get_unchecked(&self, index: usize) -> Compact<T>
pub unsafe fn get_unchecked(&self, index: usize) -> Compact<T>
Returns the element at index without bounds checking.
§Safety
index must be in bounds (index < self.len) and the slice must
reference initialized backing storage.
pub fn index(&self, index: usize) -> Compact<T>
pub fn reborrow<'b>(&'b self) -> CompactSlice<'b, T>where
'a: 'b,
pub fn slice(&self, range: Range<usize>) -> CompactSlice<'a, T>
pub fn as_ptr(&self) -> CompactPtr<T>
Sourcepub unsafe fn from_raw_parts<'b>(
data: CompactPtr<T>,
len: usize,
) -> CompactSlice<'b, T>
pub unsafe fn from_raw_parts<'b>( data: CompactPtr<T>, len: usize, ) -> CompactSlice<'b, T>
Reassembles a CompactSlice from a raw pointer and length.
§Safety
data.packed must point to valid Store<T> storage holding at least
data.index + len initialized elements, and the returned slice must
not outlive that storage.
pub fn iter(&self) -> CompactIter<'a, T> ⓘ
pub fn to_vec(&self) -> CompactVec<T>
pub fn chunks(&self, chunk_size: usize) -> CompactChunks<'a, T> ⓘ
pub fn chunks_exact(&self, chunk_size: usize) -> CompactChunksExact<'a, T> ⓘ
pub fn binary_search_by<F>(&self, f: F) -> Result<usize, usize>
pub fn binary_search_by_key<K, F>(&self, key: &K, f: F) -> Result<usize, usize>
Trait Implementations§
Source§impl<'a, T: Clone + CompactRepr> Clone for CompactSlice<'a, T>
impl<'a, T: Clone + CompactRepr> Clone for CompactSlice<'a, T>
Source§fn clone(&self) -> CompactSlice<'a, T>
fn clone(&self) -> CompactSlice<'a, T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a, T: Copy + CompactRepr> Copy for CompactSlice<'a, T>
Source§impl<T: CompactRepr + Debug> Debug for CompactSlice<'_, T>
impl<T: CompactRepr + Debug> Debug for CompactSlice<'_, T>
Source§impl<'a, T: CompactRepr> Default for CompactSlice<'a, T>
impl<'a, T: CompactRepr> Default for CompactSlice<'a, T>
impl<'a, T: CompactRepr + Eq> Eq for CompactSlice<'a, T>
Source§impl<'a, T: CompactRepr + Hash> Hash for CompactSlice<'a, T>
impl<'a, T: CompactRepr + Hash> Hash for CompactSlice<'a, T>
Source§impl<'a, T: CompactRepr> IntoIterator for CompactSlice<'a, T>
impl<'a, T: CompactRepr> IntoIterator for CompactSlice<'a, T>
Source§impl<'a, T: CompactRepr + PartialEq> PartialEq for CompactSlice<'a, T>
impl<'a, T: CompactRepr + PartialEq> PartialEq for CompactSlice<'a, T>
Source§impl<'a, T: CompactRepr> SoAIndex<CompactSlice<'a, T>> for usize
impl<'a, T: CompactRepr> SoAIndex<CompactSlice<'a, T>> for usize
Source§fn get(self, slice: CompactSlice<'a, T>) -> Option<Self::RefOutput>
fn get(self, slice: CompactSlice<'a, T>) -> Option<Self::RefOutput>
Returns the reference output in this location if in bounds,
None
otherwise.Source§unsafe fn get_unchecked(self, slice: CompactSlice<'a, T>) -> Self::RefOutput
unsafe fn get_unchecked(self, slice: CompactSlice<'a, T>) -> Self::RefOutput
Returns the reference output in this location without performing any
bounds check. Read more
Source§fn index(self, slice: CompactSlice<'a, T>) -> Self::RefOutput
fn index(self, slice: CompactSlice<'a, T>) -> Self::RefOutput
Returns the reference output in this location. Panics if it is not in
bounds.
Source§impl<'a, T: CompactRepr> SoAIndex<CompactSlice<'a, T>> for Range<usize>
impl<'a, T: CompactRepr> SoAIndex<CompactSlice<'a, T>> for Range<usize>
Source§type RefOutput = CompactSlice<'a, T>
type RefOutput = CompactSlice<'a, T>
The output for the non-mutable functions
Source§fn get(self, slice: CompactSlice<'a, T>) -> Option<Self::RefOutput>
fn get(self, slice: CompactSlice<'a, T>) -> Option<Self::RefOutput>
Returns the reference output in this location if in bounds,
None
otherwise.Source§unsafe fn get_unchecked(self, slice: CompactSlice<'a, T>) -> Self::RefOutput
unsafe fn get_unchecked(self, slice: CompactSlice<'a, T>) -> Self::RefOutput
Returns the reference output in this location without performing any
bounds check. Read more
Source§fn index(self, slice: CompactSlice<'a, T>) -> Self::RefOutput
fn index(self, slice: CompactSlice<'a, T>) -> Self::RefOutput
Returns the reference output in this location. Panics if it is not in
bounds.
Source§impl<'a, T: CompactRepr> SoAIndex<CompactSlice<'a, T>> for RangeTo<usize>
impl<'a, T: CompactRepr> SoAIndex<CompactSlice<'a, T>> for RangeTo<usize>
Source§type RefOutput = CompactSlice<'a, T>
type RefOutput = CompactSlice<'a, T>
The output for the non-mutable functions
Source§fn get(self, s: CompactSlice<'a, T>) -> Option<Self::RefOutput>
fn get(self, s: CompactSlice<'a, T>) -> Option<Self::RefOutput>
Returns the reference output in this location if in bounds,
None
otherwise.Source§unsafe fn get_unchecked(self, s: CompactSlice<'a, T>) -> Self::RefOutput
unsafe fn get_unchecked(self, s: CompactSlice<'a, T>) -> Self::RefOutput
Returns the reference output in this location without performing any
bounds check. Read more
Source§fn index(self, s: CompactSlice<'a, T>) -> Self::RefOutput
fn index(self, s: CompactSlice<'a, T>) -> Self::RefOutput
Returns the reference output in this location. Panics if it is not in
bounds.
Source§impl<'a, T: CompactRepr> SoAIndex<CompactSlice<'a, T>> for RangeFrom<usize>
impl<'a, T: CompactRepr> SoAIndex<CompactSlice<'a, T>> for RangeFrom<usize>
Source§type RefOutput = CompactSlice<'a, T>
type RefOutput = CompactSlice<'a, T>
The output for the non-mutable functions
Source§fn get(self, s: CompactSlice<'a, T>) -> Option<Self::RefOutput>
fn get(self, s: CompactSlice<'a, T>) -> Option<Self::RefOutput>
Returns the reference output in this location if in bounds,
None
otherwise.Source§unsafe fn get_unchecked(self, s: CompactSlice<'a, T>) -> Self::RefOutput
unsafe fn get_unchecked(self, s: CompactSlice<'a, T>) -> Self::RefOutput
Returns the reference output in this location without performing any
bounds check. Read more
Source§fn index(self, s: CompactSlice<'a, T>) -> Self::RefOutput
fn index(self, s: CompactSlice<'a, T>) -> Self::RefOutput
Returns the reference output in this location. Panics if it is not in
bounds.
Source§impl<'a, T: CompactRepr> SoAIndex<CompactSlice<'a, T>> for RangeFull
impl<'a, T: CompactRepr> SoAIndex<CompactSlice<'a, T>> for RangeFull
Source§type RefOutput = CompactSlice<'a, T>
type RefOutput = CompactSlice<'a, T>
The output for the non-mutable functions
Source§fn get(self, s: CompactSlice<'a, T>) -> Option<Self::RefOutput>
fn get(self, s: CompactSlice<'a, T>) -> Option<Self::RefOutput>
Returns the reference output in this location if in bounds,
None
otherwise.Source§unsafe fn get_unchecked(self, s: CompactSlice<'a, T>) -> Self::RefOutput
unsafe fn get_unchecked(self, s: CompactSlice<'a, T>) -> Self::RefOutput
Returns the reference output in this location without performing any
bounds check. Read more
Source§fn index(self, s: CompactSlice<'a, T>) -> Self::RefOutput
fn index(self, s: CompactSlice<'a, T>) -> Self::RefOutput
Returns the reference output in this location. Panics if it is not in
bounds.
Source§impl<'a, T: CompactRepr> SoAIndex<CompactSlice<'a, T>> for RangeInclusive<usize>
impl<'a, T: CompactRepr> SoAIndex<CompactSlice<'a, T>> for RangeInclusive<usize>
Source§type RefOutput = CompactSlice<'a, T>
type RefOutput = CompactSlice<'a, T>
The output for the non-mutable functions
Source§fn get(self, s: CompactSlice<'a, T>) -> Option<Self::RefOutput>
fn get(self, s: CompactSlice<'a, T>) -> Option<Self::RefOutput>
Returns the reference output in this location if in bounds,
None
otherwise.Source§unsafe fn get_unchecked(self, s: CompactSlice<'a, T>) -> Self::RefOutput
unsafe fn get_unchecked(self, s: CompactSlice<'a, T>) -> Self::RefOutput
Returns the reference output in this location without performing any
bounds check. Read more
Source§fn index(self, s: CompactSlice<'a, T>) -> Self::RefOutput
fn index(self, s: CompactSlice<'a, T>) -> Self::RefOutput
Returns the reference output in this location. Panics if it is not in
bounds.
Source§impl<'a, T: CompactRepr> SoAIndex<CompactSlice<'a, T>> for RangeToInclusive<usize>
impl<'a, T: CompactRepr> SoAIndex<CompactSlice<'a, T>> for RangeToInclusive<usize>
Source§type RefOutput = CompactSlice<'a, T>
type RefOutput = CompactSlice<'a, T>
The output for the non-mutable functions
Source§fn get(self, s: CompactSlice<'a, T>) -> Option<Self::RefOutput>
fn get(self, s: CompactSlice<'a, T>) -> Option<Self::RefOutput>
Returns the reference output in this location if in bounds,
None
otherwise.Source§unsafe fn get_unchecked(self, s: CompactSlice<'a, T>) -> Self::RefOutput
unsafe fn get_unchecked(self, s: CompactSlice<'a, T>) -> Self::RefOutput
Returns the reference output in this location without performing any
bounds check. Read more
Source§fn index(self, s: CompactSlice<'a, T>) -> Self::RefOutput
fn index(self, s: CompactSlice<'a, T>) -> Self::RefOutput
Returns the reference output in this location. Panics if it is not in
bounds.
Auto Trait Implementations§
impl<'a, T> !Send for CompactSlice<'a, T>
impl<'a, T> !Sync for CompactSlice<'a, T>
impl<'a, T> Freeze for CompactSlice<'a, T>
impl<'a, T> RefUnwindSafe for CompactSlice<'a, T>
impl<'a, T> Unpin for CompactSlice<'a, T>
impl<'a, T> UnsafeUnpin for CompactSlice<'a, T>
impl<'a, T> UnwindSafe for CompactSlice<'a, 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
Mutably borrows from an owned value. Read more