What is the best way to concatenate vectors in Rust?
The structure std::vec::Vec has method append(): fn append(&mut self, other: &mut Vec<T>) Moves all the elements of other into Self, leaving other empty. From your example, the following code will concatenate two vectors by mutating a and b: fn main() { let mut a = vec![1, 2, 3]; let mut b = vec![4, 5, 6]; … Read more