DynContigColl

Trait DynContigColl 

Source
pub trait DynContigColl<E, T>:
    AsRef<[T]>
    + Clear
    + Capacity
    + Default
    + Deref<Target = [T]>
    + DerefMut
    + Extend<T, Error = E>
    + Push<T, Error = E>
    + Truncate<Input = usize>
    + WithCapacity<Error = E, Input = usize> { }
Expand description

Dynamic Contiguous Collection

A growable vector-like abstraction for generic elements.

fn stuff<T>(dcc: &mut T)
where
    T: cl_aux::DynContigColl<cl_aux::Error, u8>
{
    dcc.clear();
    dcc.extend([4, 5, 6]).unwrap();
    dcc.truncate(1);
}

let mut dcc = vec![0, 1, 2, 3];
stuff(&mut dcc);
assert_eq!(dcc, &[4]);

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.

Implementors§

Source§

impl<E, T, U> DynContigColl<E, T> for U
where U: AsRef<[T]> + Clear + Capacity + Default + Deref<Target = [T]> + DerefMut + Extend<T, Error = E> + Push<T, Error = E> + Truncate<Input = usize> + WithCapacity<Error = E, Input = usize>,