VecDequeを使うと、vectorのpush, popが抽象化されている。
use std::collections::VecDeque; fn main() { let mut washload: VecDeque<u32> = VecDeque::new(); washload.push_back(1); washload.push_back(2); washload.push_back(3); println!("{:?}", washload); let n = washload.pop_front(); println!("{:?}", n.unwrap()); }
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.17s
Running `target/debug/parallel`
[1, 2, 3]
1
なるほど、確かに使いやすい。