Skip to main content

CompactSlice

Struct CompactSlice 

Source
pub struct CompactSlice<'a, T: CompactRepr> { /* private fields */ }

Implementations§

Source§

impl<'a, T: CompactRepr> CompactSlice<'a, T>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn first(&self) -> Option<Compact<T>>

Source

pub fn last(&self) -> Option<Compact<T>>

Source

pub fn split_first(&self) -> Option<(Compact<T>, CompactSlice<'a, T>)>

Source

pub fn split_last(&self) -> Option<(Compact<T>, CompactSlice<'a, T>)>

Source

pub fn split_at(&self, mid: usize) -> (CompactSlice<'a, T>, CompactSlice<'a, T>)

Source

pub fn get(&self, index: usize) -> Option<Compact<T>>

Source

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).

Source

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.

Source

pub fn index(&self, index: usize) -> Compact<T>

Source

pub fn reborrow<'b>(&'b self) -> CompactSlice<'b, T>
where 'a: 'b,

Source

pub fn slice(&self, range: Range<usize>) -> CompactSlice<'a, T>

Source

pub fn as_ptr(&self) -> CompactPtr<T>

Source

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.

Source

pub fn iter(&self) -> CompactIter<'a, T>

Source

pub fn to_vec(&self) -> CompactVec<T>

Source

pub fn chunks(&self, chunk_size: usize) -> CompactChunks<'a, T>

Source

pub fn chunks_exact(&self, chunk_size: usize) -> CompactChunksExact<'a, T>

Source

pub fn binary_search_by<F>(&self, f: F) -> Result<usize, usize>
where F: FnMut(Compact<T>) -> Ordering,

Source

pub fn binary_search_by_key<K, F>(&self, key: &K, f: F) -> Result<usize, usize>
where K: Ord, F: FnMut(Compact<T>) -> K,

Trait Implementations§

Source§

impl<'a, T: Clone + CompactRepr> Clone for CompactSlice<'a, T>

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl<'a, T: Copy + CompactRepr> Copy for CompactSlice<'a, T>

Source§

impl<T: CompactRepr + Debug> Debug for CompactSlice<'_, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, T: CompactRepr> Default for CompactSlice<'a, T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a, T: CompactRepr + Eq> Eq for CompactSlice<'a, T>

Source§

impl<'a, T: CompactRepr + Hash> Hash for CompactSlice<'a, T>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a, T: CompactRepr> IntoIterator for CompactSlice<'a, T>

Source§

type Item = Compact<T>

The type of the elements being iterated over.
Source§

type IntoIter = CompactIter<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T: CompactRepr + PartialEq> PartialEq for CompactSlice<'a, T>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a, T: CompactRepr> SoAIndex<CompactSlice<'a, T>> for usize

Source§

type RefOutput = Compact<T>

The output for the non-mutable functions
Source§

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

Returns the reference output in this location without performing any bounds check. Read more
Source§

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>

Source§

type RefOutput = CompactSlice<'a, T>

The output for the non-mutable functions
Source§

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

Returns the reference output in this location without performing any bounds check. Read more
Source§

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>

Source§

type RefOutput = CompactSlice<'a, T>

The output for the non-mutable functions
Source§

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

Returns the reference output in this location without performing any bounds check. Read more
Source§

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>

Source§

type RefOutput = CompactSlice<'a, T>

The output for the non-mutable functions
Source§

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

Returns the reference output in this location without performing any bounds check. Read more
Source§

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

Source§

type RefOutput = CompactSlice<'a, T>

The output for the non-mutable functions
Source§

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

Returns the reference output in this location without performing any bounds check. Read more
Source§

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>

Source§

type RefOutput = CompactSlice<'a, T>

The output for the non-mutable functions
Source§

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

Returns the reference output in this location without performing any bounds check. Read more
Source§

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>

Source§

type RefOutput = CompactSlice<'a, T>

The output for the non-mutable functions
Source§

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

Returns the reference output in this location without performing any bounds check. Read more
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.