Type erased vector [AnyVec]. Allow to store elements of the same type.
Have same performance and operations as [std::vec::Vec].
You can downcast type erased [AnyVec] to concrete [AnyVecTyped<Element>] with downcast-family.
Or use [AnyVec]s type erased operations, which works with AnyValue.
use AnyVec;
use AnyValue;
let mut vec: AnyVec = ;
let mut other_vec: AnyVec = ;
// Fully type erased element move from one vec to another
// without intermediate mem-copies.
let element = vec.swap_remove;
other_vec.push;
// Output 2 1
for s in vec..unwrap.as_slice
Send, Sync, Clone
You can make [AnyVec] [Send]able, [Sync]able, Cloneable:
use AnyVec;
use *;
let v1: = ;
let v2 = v1.clone;
This constraints will be applied compiletime to element type:
# use any_vec::AnyVec;
# use std::rc::Rc;
let v1: AnyVec<dyn Sync + Send> = AnyVec::new::<Rc<usize>>();