title: How do I iterate over a list of chars while still being able to skip in the iteration?
body: <p>I have the following piece of code:</p>
  
  <pre><code>let mut lex_index = 0;
  let chars = expression.chars();
  while lex_index &lt; chars.count() {
      if(chars[lex_index] == "something") {
          lex_index += 2;
      } else {
          lex_index += 1;
      }
  }
  </code></pre>
  
  <p>I use a <code>while</code> loop here since I sometimes need to skip a char in <code>chars</code>.
  However, this gives me the following error: </p>
  
  <pre class="lang-none prettyprint-override"><code>error[E0382]: use of moved value: `chars`
    --&gt; src/main.rs:23:15
     |
  23 |     while i &lt; chars.count() {
     |               ^^^^^ value moved here in previous iteration of loop
     |
     = note: move occurs because `chars` has type `std::str::Chars&lt;'_&gt;`, which does not implement the `Copy` trait
  </code></pre>