Chunking a vector of strings
<p>I'm trying to chunk an vector of uneven length strings into a vector of even length strings. The laziest way I could think of doing this is to join the arguments into a string, convert the chars to a vector, and then use <a href="https://doc.rust-lang.org/std/vec/struct.Vec.html#method.chunks" rel="nofollow noreferrer"><code>Vec::chunks</code></a>. Unfortunately, I'm running into issues trying to collect the chunks into strings.</p>

<pre><code>let args: Vec&lt;String&gt; = ["123", "4", "56"].iter().map(|&amp;s| s.into()).collect();

let result: Vec&lt;String&gt; = args
    .join(" ")
    .chars()
    .collect::&lt;Vec&lt;_&gt;&gt;()
    .chunks(2)
    .map(|c| c.collect::&lt;String&gt;())
    .collect::&lt;Vec&lt;String&gt;&gt;();

assert_eq!(["12", "34", "56"], result);
</code></pre>

<p>Results in the error:</p>

<pre class="lang-none prettyprint-override"><code>error[E0599]: no method named `collect` found for type `&amp;[char]` in the current scope
 --&gt; src/main.rs:9:20
  |
9 |         .map(|c| c.collect::&lt;String&gt;())
  |                    ^^^^^^^
  |
  = note: the method `collect` exists but the following trait bounds were not satisfied:
          `&amp;mut &amp;[char] : std::iter::Iterator`
          `&amp;mut [char] : std::iter::Iterator`
</code></pre>