title: How to convert a 4 element &[u8] into i32?
body: <p>I have an <code>i32</code> that i pass to my keyvalue database.</p>
  <pre class="lang-rs prettyprint-override"><code>let a = 1234i32;
  db.put(&amp;a.to_be_bytes());
  </code></pre>
  <p>But i get it back as <code>&amp;[u8]</code>, how to convert it back to <code>i32</code>?</p>
  <hr />
  <p>update: this example pretty much does what i want.</p>
  <pre><code>use std::convert::TryInto;
  
  fn read_be_i32(input: &amp;[u8]) -&gt; i32 {
      i32::from_be_bytes(input.try_into().unwrap())
  }
  </code></pre>