title: How to generate iterator with sliding window pairs?
body: <p>I'd like to create an iterator that for this input:</p>
  <pre><code>[1, 2, 3, 4]
  </code></pre>
  <p>Will contain the following:</p>
  <pre><code>(1, 2)
  (2, 3)
  (3, 4)
  </code></pre>
  <p><code>Peekable</code> seems ideal for this, but I'm new to Rust, so this naïve version doesn't work:</p>
  <pre><code>fn main() {
    let i = ['a', 'b', 'c']
      .iter()
      .peekable();
    let j = i.map(|x| (x, i.peek()));
    println!(&quot;{:?}&quot;, j);
    println!(&quot;Hello World!&quot;);
  }
  </code></pre>
  <p>What am I doing wrong?</p>