title: How to iterate over itertools::chunks
body: <p>I'm a new rustacean, so my code's quality is questionable.
  While trying to get the ropes of rust, I've come across the following problem.</p>
  
  <p>I have a vector of bits (<code>bool</code>s), and I want to convert then into a vector of bytes (<code>u8</code>)</p>
  
  <p>My first implementation looked like that</p>
  
  <pre><code>let mut res: Vec&lt;u8&gt; = vec![];
  let mut curr = 0;
  for (idx, &amp;bit) in bits.iter().enumerate() {
      let x = (idx % 8) as u8;
      if idx % 8 != 0 || idx == 0 {
          curr = set_bit_at(curr, (7 - (idx % 8)) as u32, bit).unwrap();
      } else {
          res.push(curr);
          curr = 0
      }
  }
  res.push(curr);
  </code></pre>
  
  <p>It worked, but It felt pretty ugly, so I've tried to implement it using the crate itertools.</p>
  
  <pre><code>let res = bits.iter()
      .chunks(8)
      .map(|split_byte: Vec&lt;u8&gt;| {
          split_byte.fold(0, |res, &amp;bit| (res &lt;&lt; 1) | (bit as u8))
      })
      .collect();
  </code></pre>
  
  <p>It sure looks nicer, but sadly - it didn't work.</p>
  
  <p>Even though it seems as if <code>chunks</code>'s return type <a href="https://docs.rs/itertools/0.4.8/itertools/struct.Chunks.html" rel="noreferrer">seems</a> to be an iterator, this line produced the following error</p>
  
  <pre><code>error[E0599]: no method named `map` found for type `bits::itertools::IntoChunks&lt;std::slice::Iter&lt;'_, bool&gt;&gt;` in the current scope
  </code></pre>
  
  <p>Could anyone tell what did I do wrong?</p>