pub trait BatchContainer: for<'a> PushInto<Self::ReadItem<'a>> + 'static {
    type Owned;
    type ReadItem<'a>: Copy + Ord + IntoOwned<'a, Owned = Self::Owned>;

    // Required methods
    fn with_capacity(size: usize) -> Self;
    fn merge_capacity(cont1: &Self, cont2: &Self) -> Self;
    fn reborrow<'b, 'a: 'b>(item: Self::ReadItem<'a>) -> Self::ReadItem<'b>;
    fn index(&self, index: usize) -> Self::ReadItem<'_>;
    fn len(&self) -> usize;

    // Provided methods
    fn push<D>(&mut self, item: D)
       where Self: PushInto<D> { ... }
    fn last(&self) -> Option<Self::ReadItem<'_>> { ... }
    fn is_empty(&self) -> bool { ... }
    fn advance<F: for<'a> Fn(Self::ReadItem<'a>) -> bool>(
        &self,
        start: usize,
        end: usize,
        function: F,
    ) -> usize { ... }
}
Expand description

A general-purpose container resembling Vec<T>.

Required Associated Types§

source

type Owned

An owned instance of Self::ReadItem<'_>.

source

type ReadItem<'a>: Copy + Ord + IntoOwned<'a, Owned = Self::Owned>

The type that can be read back out of the container.

Required Methods§

source

fn with_capacity(size: usize) -> Self

Creates a new container with sufficient capacity.

source

fn merge_capacity(cont1: &Self, cont2: &Self) -> Self

Creates a new container with sufficient capacity.

source

fn reborrow<'b, 'a: 'b>(item: Self::ReadItem<'a>) -> Self::ReadItem<'b>

Converts a read item into one with a narrower lifetime.

source

fn index(&self, index: usize) -> Self::ReadItem<'_>

Reference to the element at this position.

source

fn len(&self) -> usize

Number of contained elements

Provided Methods§

source

fn push<D>(&mut self, item: D)
where Self: PushInto<D>,

Push an item into this container

source

fn last(&self) -> Option<Self::ReadItem<'_>>

Returns the last item if the container is non-empty.

source

fn is_empty(&self) -> bool

Indicates if the length is zero.

source

fn advance<F: for<'a> Fn(Self::ReadItem<'a>) -> bool>( &self, start: usize, end: usize, function: F, ) -> usize

Reports the number of elements satisfying the predicate.

This methods relies strongly on the assumption that the predicate stays false once it becomes false, a joint property of the predicate and the layout of Self. This allows advance` to use exponential search to count the number of elements in time logarithmic in the result.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<R> BatchContainer for FlatStack<R>
where for<'a> R: Region + Push<<R as Region>::ReadItem<'a>> + 'static, for<'a> R::ReadItem<'a>: Copy + Ord,

§

type Owned = <R as Region>::Owned

§

type ReadItem<'a> = <R as Region>::ReadItem<'a>

source§

fn with_capacity(size: usize) -> Self

source§

fn merge_capacity(cont1: &Self, cont2: &Self) -> Self

source§

fn reborrow<'b, 'a: 'b>(item: Self::ReadItem<'a>) -> Self::ReadItem<'b>

source§

fn index(&self, index: usize) -> Self::ReadItem<'_>

source§

fn len(&self) -> usize

source§

impl<T: Clone + Ord + Columnation + 'static> BatchContainer for TimelyStack<T>

§

type Owned = T

§

type ReadItem<'a> = &'a T

source§

fn reborrow<'b, 'a: 'b>(item: Self::ReadItem<'a>) -> Self::ReadItem<'b>

source§

fn with_capacity(size: usize) -> Self

source§

fn merge_capacity(cont1: &Self, cont2: &Self) -> Self

source§

fn index(&self, index: usize) -> Self::ReadItem<'_>

source§

fn len(&self) -> usize

source§

impl<T: Ord + Clone + 'static> BatchContainer for Vec<T>

§

type Owned = T

§

type ReadItem<'a> = &'a T

source§

fn reborrow<'b, 'a: 'b>(item: Self::ReadItem<'a>) -> Self::ReadItem<'b>

source§

fn with_capacity(size: usize) -> Self

source§

fn merge_capacity(cont1: &Self, cont2: &Self) -> Self

source§

fn index(&self, index: usize) -> Self::ReadItem<'_>

source§

fn len(&self) -> usize

Implementors§

source§

impl BatchContainer for OffsetList

§

type Owned = usize

§

type ReadItem<'a> = usize

source§

impl<B> BatchContainer for SliceContainer<B>
where B: Ord + Clone + Sized + 'static,

§

type Owned = Vec<B>

§

type ReadItem<'a> = &'a [B]

source§

impl<B: Ord + Clone + 'static> BatchContainer for HuffmanContainer<B>

§

type Owned = Vec<B>

§

type ReadItem<'a> = Wrapped<'a, B>