Trait timely::Container

source ·
pub trait Container: Default + Clone + 'static {
    type Item;

    // Required methods
    fn len(&self) -> usize;
    fn capacity(&self) -> usize;
    fn clear(&mut self);

    // Provided method
    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.) TODO: Don’t require Container: Clone

Required Associated Types§

source

type Item

The type of elements this container holds.

Required Methods§

source

fn len(&self) -> usize

The number of elements in this container

The length of a container must be consistent between sending and receiving it. When exchanging a container and partitioning it into pieces, the sum of the length of all pieces must be equal to the length of the original container.

source

fn capacity(&self) -> usize

The capacity of the underlying container

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.

Provided Methods§

source

fn is_empty(&self) -> bool

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

Implementations on Foreign Types§

source§

impl<T> Container for Vec<T, Global>where T: Clone + 'static,

§

type Item = T

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

fn capacity(&self) -> usize

source§

fn clear(&mut self)

source§

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

§

type Item = <T as Container>::Item

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

fn capacity(&self) -> usize

source§

fn clear(&mut self)

source§

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

§

type Item = <T as Container>::Item

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

fn capacity(&self) -> usize

source§

fn clear(&mut self)

Implementors§

source§

impl<T> Container for TimelyStack<T>where T: Columnation + 'static,

§

type Item = T