Is there a safe way to left-shift elements of a vector in Rust? (vec![1, 2, 3]
becomes vec![3]
when left-shifted two places). I'm dealing with Copy
types, and I don't want to pay a penalty higher than what I would with a memmove
.
The only solution I've found is unsafe: use memmove
directly via ptr::copy
.