[][src]Struct flatk::chunked::Offsets

pub struct Offsets<O = Vec<usize>>(_);

A collection of offsets into another collection. This newtype is intended to verify basic invariants about offsets into another collection, namely that the collection is monotonically increasing and non-empty.

Methods

impl<'a> Offsets<&'a [usize]>[src]

pub fn pop_offset(&mut self) -> Option<usize>[src]

Pops an offset from the given slice of offsets and produces an increment for advancing the data pointer. This is a helper function for implementing iterators over Chunked types. This function panics if offsets is empty.

impl<O: AsRef<[usize]>> Offsets<O>[src]

pub fn new(offsets: O) -> Self[src]

impl<O> Offsets<O>[src]

pub fn into_inner(self) -> O[src]

Trait Implementations

impl<O: AsMut<[usize]>> AsMut<[usize]> for Offsets<O>[src]

impl<O: AsRef<[usize]>> AsRef<[usize]> for Offsets<O>[src]

impl Clear for Offsets[src]

impl<O: Clone> Clone for Offsets<O>[src]

impl<O: Copy> Copy for Offsets<O>[src]

impl<O: Debug> Debug for Offsets<O>[src]

impl Default for Offsets<Vec<usize>>[src]

A default set of offsets must allocate.

impl<O: Dummy> Dummy for Offsets<O>[src]

impl<O: AsRef<[usize]>> From<O> for Offsets<O>[src]

impl<O: FromIterator<usize> + AsRef<[usize]>> FromIterator<usize> for Offsets<O>[src]

impl<'a, O: Get<'a, Range<usize>>> GetIndex<'a, Offsets<O>> for Range<usize>[src]

type Output = Offsets<O::Output>

impl<I: SliceIndex<[usize]>, O: AsRef<[usize]>> Index<I> for Offsets<O>[src]

type Output = I::Output

The returned type after indexing.

impl<I: SliceIndex<[usize]>, O: AsRef<[usize]> + AsMut<[usize]>> IndexMut<I> for Offsets<O>[src]

impl<O: AsRef<[usize]>> IndexRange for Offsets<O>[src]

fn index_range(&self, range: Range<usize>) -> Option<Range<usize>>[src]

Return the [begin..end) bound of the chunk at the given index.

impl<O: IntoIterator> IntoIterator for Offsets<O>[src]

type Item = O::Item

The type of the elements being iterated over.

type IntoIter = O::IntoIter

Which kind of iterator are we turning this into?

impl<O: IntoOwned> IntoOwned for Offsets<O>[src]

type Owned = Offsets<O::Owned>

impl<O: Isolate<Range<usize>>> IsolateIndex<Offsets<O>> for Range<usize>[src]

type Output = Offsets<O::Output>

impl<O: PartialEq> PartialEq<Offsets<O>> for Offsets<O>[src]

impl<O: Push<usize>> Push<usize> for Offsets<O>[src]

impl<O: RemovePrefix> RemovePrefix for Offsets<O>[src]

impl<O: Reserve> Reserve for Offsets<O>[src]

impl<O: Set> Set for Offsets<O>[src]

type Elem = O::Elem

Owned element of the set.

type Atom = O::Atom

The most basic element contained by this collection. If this collection contains other collections, this type should be different than Elem. Read more

impl<'a> SplitOffsetsAt for Offsets<&'a [usize]>[src]

fn split_offsets_at(
    self,
    mid: usize
) -> (Offsets<&'a [usize]>, Offsets<&'a [usize]>, usize)
[src]

Splits a slice of offsets at the given index into two slices such that each slice is a valid slice of offsets. This means that the element at index mid is shared between the two output slices. In addition, return the offset of the middle element: this is the value offsets[mid] - offsets[0].

Panics

Calling this function with an empty slice or with mid greater than or equal to its length will cause a panic.

impl<O> StructuralPartialEq for Offsets<O>[src]

impl<O: Truncate> Truncate for Offsets<O>[src]

impl<'a, O: AsRef<[usize]>> View<'a> for Offsets<O>[src]

type Type = Offsets<&'a [usize]>

impl<'a, O: AsMut<[usize]>> ViewMut<'a> for Offsets<O>[src]

type Type = Offsets<&'a mut [usize]>

impl<O: Viewed> Viewed for Offsets<O>[src]

Auto Trait Implementations

impl<O> RefUnwindSafe for Offsets<O> where
    O: RefUnwindSafe

impl<O> Send for Offsets<O> where
    O: Send

impl<O> Sync for Offsets<O> where
    O: Sync

impl<O> Unpin for Offsets<O> where
    O: Unpin

impl<O> UnwindSafe for Offsets<O> where
    O: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AsSlice<T> for T[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<'a, S, I> Get<'a, I> for S where
    I: GetIndex<'a, S>, 
[src]

type Output = <I as GetIndex<'a, S>>::Output

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<S, I> Isolate<I> for S where
    I: IsolateIndex<S>, 
[src]

type Output = <I as IsolateIndex<S>>::Output

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.