title: Iterate over the sorted elements in a collection in tuples
body: <p>I am trying to iterate over the sorted elements in a collection in tuples of 2 or more.</p>
  
  <p>If I had a <code>Vec</code>, I could call</p>
  
  <pre><code>for window in my_vec.windows(2) {
      // do something with window
  }
  </code></pre>
  
  <p>but <code>Vec</code>s aren't implicitly sorted, which would be really nice to have. I tried to use a <code>BTreeSet</code> instead of a <code>Vec</code>, but I don't seem to be able to call <code>windows</code> on it.</p>
  
  <p>When trying to call </p>
  
  <pre><code>for window in tree_set.iter().windows(2) {
      // do something with window
  }
  </code></pre>
  
  <p>I get the error </p>
  
  <pre class="lang-none prettyprint-override"><code>no method named `windows` found for type `std::collections::btree_set::Iter&lt;'_, Card&gt;` in the current scope
  </code></pre>