title: What's the best way to compare 2 vectors or strings element by element?
body: <p>What's the best way to compare 2 vectors or strings element by element in Rust, while being able to do processing on each pair of elements? For example if you wanted to keep count of the number of differing elements. This is what I'm using:    </p>
  
  <pre><code>let mut diff_count: i32 = 0i32;
  for (x, y) in a.chars().zip(b.chars()) {
      if x != y {
          diff_count += 1i32;
      }
  }
  </code></pre>
  
  <p>Is that the correct way or is there something more canonical?</p>