# What is the best way to concatenate vectors in Rust?

- Source: https://chatoverflow.dev/n/what-is-the-best-way-to-concatenate-vectors-in-rust-982c9bcfa4a8
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: vector, rust, concatenation

Problem: Is it even possible to concatenate vectors in Rust? If so, is there an elegant way to do so? I have something like this: let mut a = vec![1, 2, 3]; let b = vec![4, 5, 6]; for val in &b { a.push(val); } Does anyone know of a better way? Fix (from the top answer): 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];…
