title: How does the VecDeque ring buffer work internally?
body: <p>The <a href="https://doc.rust-lang.org/std/collections/struct.VecDeque.html" rel="noreferrer"><code>VecDeque</code> documentation</a> says that it uses a growable ring buffer as implementation.</p>
  
  <p>How does it work internally?</p>
  
  <ul>
  <li>In the case when I only use it as a queue (only <code>push_back</code> and <code>pop_front</code>), when is the shifting done? Each time I call <code>pop_front</code>? When the internal buffer reaches a critical size?</li>
  <li>Why are there two slices (one for the back, one for the front)? Are they not contiguous?</li>
  </ul>