title: Is there a good way to convert a Vec<T> to an array?
body: <p>Is there a good way to convert a <code>Vec&lt;T&gt;</code> with size <code>S</code> to an array of type <code>[T; S]</code>? Specifically, I'm using a function that returns a 128-bit hash as a <code>Vec&lt;u8&gt;</code>, which will always have length 16, and I would like to deal with the hash as a <code>[u8, 16]</code>. </p>
  
  <p>Is there something built-in akin to the <code>as_slice</code> method which gives me what I want, or should I write my own function which allocates a fixed-size array, iterates through the vector copying each element, and returns the array?</p>