title: How to set a range in a Vec or slice?
body: <p>My end goal is to shuffle the rows of a matrix (for which I am using nalgebra).</p>
  
  <p>To address this I need to set a mutable range (slice) of an array.
  Supposing I have an array as such (let's say it's a 3x3 matrix):</p>
  
  <pre><code>let mut scores = [7, 8, 9, 10, 11, 12, 13, 14, 15];
  </code></pre>
  
  <p>I have extracted a row like this:</p>
  
  <pre><code>let r = &amp;scores[..].chunks(3).collect::&lt;Vec&lt;_&gt;&gt;()[1];
  </code></pre>
  
  <p>Now, for the knuth shuffle I need to swap this with another row. What I need to do is:</p>
  
  <pre><code>scores.chunks_mut(3)[0] = r;
  </code></pre>
  
  <p>however this fails as such:</p>
  
  <pre><code>cannot index a value of type `core::slice::ChunksMut&lt;'_, _&gt;`
  </code></pre>
  
  <p>Example: <a href="http://is.gd/ULkN6j" rel="nofollow">http://is.gd/ULkN6j</a></p>