Well, first of all, the incorrect definition of the initial sequence. You say you want 1, 2, 3, 8, 9, 10 as output, so it should look like this:
let v = (1u64 .. 11).collect::<Vec<_>>();
Then you say that you want to merge the fragments, so let them actually use slices:
let head = &v[..3]; let tail = &v[l-3..];
At the moment, this is really what approach you like the most. You can turn these fragments into iterators, a chain, then compile ...
let v2: Vec<_> = head.iter().chain(tail.iter()).collect();
... or make vec and expand it with slices directly ...
let mut v3 = vec![]; v3.extend_from_slice(head); v3.extend_from_slice(tail);
... or to expand the use of more general iterators (which will become the equivalent in the future with specialization, but I still do not consider it effective) ...
let mut v4: Vec<u64> = vec![]; v4.extend(head); v4.extend(tail);
... or you can use Vec::with_capacity and push in a loop, or make an iterator chain, but using extend ... but I have to stop at some point.
Full example code:
fn main() { let v = (1u64 .. 11).collect::<Vec<_>>(); let l = v.len(); let head = &v[..3]; let tail = &v[l-3..]; println!("head: {:?}", head); println!("tail: {:?}", tail); let v2: Vec<_> = head.iter().chain(tail.iter()).collect(); println!("v2: {:?}", v2); let mut v3 = vec![]; v3.extend_from_slice(head); v3.extend_from_slice(tail); println!("v3: {:?}", v3); // Explicit type to help inference. let mut v4: Vec<u64> = vec![]; v4.extend(head); v4.extend(tail); println!("v4: {:?}", v4); }