title: Getting sequence of bytes (u8) from a char
body: <p>I need to examine the bytes that make up a character. I know it is possible to do so by going from a <code>char</code> to a <code>String</code> to a <code>&amp;[u8]</code> like so:</p>
  
  <pre><code>let multi_byte_char = 'á';
  let little_string = multi_byte_char.to_string();
  let byte_slice = little_string.as_bytes();
  
  for byte in byte_slice {
      println!("{}", byte); // Prints "195, 161"
  }
  </code></pre>
  
  <p>Is there a way to go straight from a <code>char</code> to a <code>&amp;[u8]</code>? I can't find anything in <a href="https://doc.rust-lang.org/std/primitive.char.html" rel="noreferrer">the char documentation</a>. Another option is to <code>mem::transmute</code> from a <code>char</code> to a <code>[u8; 4]</code>, but using unsafe code here seems silly.</p>
  
  <p>EDIT: There is <a href="http://doc.rust-lang.org/std/primitive.char.html#method.encode_utf8" rel="noreferrer">an unstable <code>encode_utf8</code> method</a> on <code>char</code>.</p>