title: How do I print a vector of u8 as a string?
body: <p>Here's my code:</p>
  
  <pre><code>let mut altbuf: Vec&lt;u8&gt; = Vec::new();
  
  // Stuff here...
  
  match stream.read_byte() {
      Ok(d) =&gt; altbuf.push(d),
      Err(e) =&gt; { println!("Error: {}", e); doneflag = true; }
  }
  
  for x in altbuf.iter() {
      println!("{}", x);
  }
  </code></pre>
  
  <p>The code prints u8 bytes which are correct, but I can't figure out for the life of me how to convert a vector of pure u8 bytes into a string? The only other answer to a similar question on stack overflow assumes that you're working with a vector of type &amp;[u8].</p>