[−][src]Macro col_macros::vector
Construct or update a vector of type Vector<T> which can be and is an alias to Vec
It does so by simply creating an array from the elements,set the capacity of the vec at they length,read each entry into and mem::forget the array.
Collections with a capacity and the push method are accepted,like BinaryHeap
.
Examples
use col_macros::vector; use col_macros::types::Vector; let mut vec: Vec<u32> = vector![1, 2, 3]; assert_eq!(vec, vec![1, 2, 3]); vector![for &mut vec, ins 4, 5, 6].push(7); // we still have a mutable reference assert_eq!(vec, vector![1, 2, 3, 4, 5, 6, 7]); assert_eq!(vec![0; 8], vector![0; 8]);