fn next(&mut self) -> Option<Self::Item> {
        // Get next part length
        let part = cmp::min(self.a0.len(), self.b0.len());
        if part == 0 {
            return None;
        }
        let (p0, p1) = replace(&mut self.a0, &mut []).split_at_mut(part);
        let (q0, q1) = self.b0.split_at(part);

        // Move a1 into a0, if it's empty (and b1, b0 the same way).
        self.a0 = p1;
        self.b0 = q1;
        if self.a0.is_empty() {
            self.a0 = replace(&mut self.a1, &mut []);
        }
        if self.b0.is_empty() {
            self.b0 = replace(&mut self.b1, &[]);
        }
        Some((p0, q0))
    }
A double-ended queue implemented with a growable ring buffer.

The "default" usage of this type as a queue is to use [`push_back`] to add to
the queue, and [`pop_front`] to remove from the queue. [`extend`] and [`append`]
push onto the back in this manner, and iterating over `VecDeque` goes front
to back.

Since `VecDeque` is a ring buffer, its elements are not necessarily contiguous
in memory. If you want to access the elements as a single slice, such as for
efficient sorting, you can use [`make_contiguous`]. It rotates the `VecDeque`
so that its elements do not wrap, and returns a mutable slice to the
now-contiguous element sequence.
benchmarks/haystacks/code/rust-library.rs