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§
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.