[][src]Trait vec_utils::TupleElem

pub unsafe trait TupleElem {
    type Item;
    type Data;
    type Iter: Iterator<Item = Self::Item>;
    fn capacity(data: &Self::Data) -> usize;
fn len(&self) -> usize;
fn into_data(self) -> Self::Data;
fn into_iterator(self) -> Self::Iter;
fn check_layout<V>() -> bool;
unsafe fn take_output<V>(data: &mut Self::Data) -> Output<V>;
unsafe fn next_unchecked(data: &mut Self::Data) -> Self::Item;
unsafe fn drop_rest(data: &mut Self::Data, len: usize); }

This trait abstracts away elements of the input stream

Safety

  • It must be valid to call next_unchecked at least len times
  • len <= capacity
  • if next_unchecked defers to another T: TupleElem, then you should not call T::next_unchecked more than once in your own next_unchecked

Associated Types

type Item

The items yielded from this element

type Data

The data-segment that Output<V> is derived from and yields Items

type Iter: Iterator<Item = Self::Item>

An iterator over the items in the collection

Loading content...

Required methods

fn capacity(data: &Self::Data) -> usize

The capacity of the data-segment

fn len(&self) -> usize

The currently initialized length of the data-segment

must be less than or equal to the capacity

fn into_data(self) -> Self::Data

Convert into a raw data-segment

fn into_iterator(self) -> Self::Iter

Convert to an iterator if we cannot reuse the data-segment

fn check_layout<V>() -> bool

If this returns true if it is safe to call take_output

unsafe fn take_output<V>(data: &mut Self::Data) -> Output<V>

Try and create a new output data-segment, if the output segment is created, then it owns it's allocation. So you must not deallocate the allocation backing Output<V>

Safety

check_layout::<V> must return true.

unsafe fn next_unchecked(data: &mut Self::Data) -> Self::Item

Get the next_unchecked element

Safety

This must be called at most len times

unsafe fn drop_rest(data: &mut Self::Data, len: usize)

Drop the rest of the buffer and deallocate if do_pick was never called

Safety

This function should only be called once, and data should not be used again

Loading content...

Implementations on Foreign Types

impl<A: TupleElem> TupleElem for (A,)[src]

type Item = A::Item

type Data = A::Data

type Iter = A::Iter

impl<A> TupleElem for Vec<A>[src]

type Item = A

type Data = Input<A>

type Iter = IntoIter<A>

Loading content...

Implementors

Loading content...