Trait timely::container::Container

source ·
pub trait Container: Default {
    type ItemRef<'a>
       where Self: 'a;
    type Item<'a>
       where Self: 'a;
    type Iter<'a>: Iterator<Item = Self::ItemRef<'a>>
       where Self: 'a;
    type DrainIter<'a>: Iterator<Item = Self::Item<'a>>
       where Self: 'a;

    // Required methods
    fn len(&self) -> usize;
    fn clear(&mut self);
    fn iter(&self) -> Self::Iter<'_>;
    fn drain(&mut self) -> Self::DrainIter<'_>;

    // Provided methods
    fn push<T>(&mut self, item: T)
       where Self: PushInto<T> { ... }
    fn is_empty(&self) -> bool { ... }
}
Expand description

A container transferring data through dataflow edges

A container stores a number of elements and thus is able to describe it length (len()) and whether it is empty (is_empty()). It supports removing all elements (clear).

A container must implement default. The default implementation is not required to allocate memory for variable-length components.

We require the container to be cloneable to enable efficient copies when providing references of containers to operators. Care must be taken that the type’s clone_from implementation is efficient (which is not necessarily the case when deriving Clone.)

Required Associated Types§

source

type ItemRef<'a> where Self: 'a

The type of elements when reading non-destructively from the container.

source

type Item<'a> where Self: 'a

The type of elements when draining the container.

source

type Iter<'a>: Iterator<Item = Self::ItemRef<'a>> where Self: 'a

Iterator type when reading from the container.

source

type DrainIter<'a>: Iterator<Item = Self::Item<'a>> where Self: 'a

Iterator type when draining the container.

Required Methods§

source

fn len(&self) -> usize

The number of elements in this container

This number is used in progress tracking to confirm the receipt of some number of outstanding records, and it is highly load bearing. The main restriction is imposed on the LengthPreservingContainerBuilder trait, whose implementors must preserve the number of items.

source

fn clear(&mut self)

Remove all contents from self while retaining allocated memory. After calling clear, is_empty must return true and len 0.

source

fn iter(&self) -> Self::Iter<'_>

Returns an iterator that reads the contents of this container.

source

fn drain(&mut self) -> Self::DrainIter<'_>

Returns an iterator that drains the contents of this container. Drain leaves the container in an undefined state.

Provided Methods§

source

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

Push item into self

source

fn is_empty(&self) -> bool

Determine if the container contains any elements, corresponding to len() == 0.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> Container for Rc<T>
where T: Container,

§

type ItemRef<'a> = <T as Container>::ItemRef<'a> where Rc<T>: 'a

§

type Item<'a> = <T as Container>::ItemRef<'a> where Rc<T>: 'a

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

fn clear(&mut self)

§

type Iter<'a> = <T as Container>::Iter<'a> where Rc<T>: 'a

source§

fn iter(&self) -> <Rc<T> as Container>::Iter<'_>

§

type DrainIter<'a> = <T as Container>::Iter<'a> where Rc<T>: 'a

source§

fn drain(&mut self) -> <Rc<T> as Container>::DrainIter<'_>

source§

impl<T> Container for Arc<T>
where T: Container,

§

type ItemRef<'a> = <T as Container>::ItemRef<'a> where Arc<T>: 'a

§

type Item<'a> = <T as Container>::ItemRef<'a> where Arc<T>: 'a

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

fn clear(&mut self)

§

type Iter<'a> = <T as Container>::Iter<'a> where Arc<T>: 'a

source§

fn iter(&self) -> <Arc<T> as Container>::Iter<'_>

§

type DrainIter<'a> = <T as Container>::Iter<'a> where Arc<T>: 'a

source§

fn drain(&mut self) -> <Arc<T> as Container>::DrainIter<'_>

source§

impl<T> Container for Vec<T>

§

type ItemRef<'a> = &'a T where T: 'a

§

type Item<'a> = T where T: 'a

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

fn clear(&mut self)

§

type Iter<'a> = Iter<'a, T> where Vec<T>: 'a

source§

fn iter(&self) -> <Vec<T> as Container>::Iter<'_>

§

type DrainIter<'a> = Drain<'a, T> where Vec<T>: 'a

source§

fn drain(&mut self) -> <Vec<T> as Container>::DrainIter<'_>

Implementors§

source§

impl<R> Container for FlatStack<R>
where R: Region,

§

type ItemRef<'a> = <R as Region>::ReadItem<'a> where FlatStack<R>: 'a

§

type Item<'a> = <R as Region>::ReadItem<'a> where FlatStack<R>: 'a

§

type Iter<'a> = <&'a FlatStack<R> as IntoIterator>::IntoIter where FlatStack<R>: 'a

§

type DrainIter<'a> = <FlatStack<R> as Container>::Iter<'a> where FlatStack<R>: 'a

source§

impl<T> Container for TimelyStack<T>
where T: Columnation,

§

type ItemRef<'a> = &'a T where TimelyStack<T>: 'a

§

type Item<'a> = &'a T where TimelyStack<T>: 'a

§

type Iter<'a> = Iter<'a, T> where TimelyStack<T>: 'a

§

type DrainIter<'a> = Iter<'a, T> where TimelyStack<T>: 'a