Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Append One Vec To Another Vec In Rust

From the docs

Code

let mut vec = vec![1, 2, 3];
let mut vec2 = vec![4, 5, 6];

vec.append(&mut vec2);

assert_eq!(vec, [1, 2, 3, 4, 5, 6]);
assert_eq!(vec2, []);

References