title: How to create a Field-Less Enum variant from its discriminant?
body: <p>If I want to know the discriminant of an enum variant, all I need to do is <code>my_variant as usize</code> (or whatever <code>{integer}</code> type). What if I have the discriminant, and I want to get the corresponding variant ?</p>
  
  <p>I obviously tried the reverse <code>my_int as MyEnum</code>, but it (unsurprisingly) didn't work.</p>
  
  <pre class="lang-rust prettyprint-override"><code>enum Enu {
      X,
      Y,
  }
  
  fn main() {
      let discr_x = Enu::X as usize;
      let x = magic(discr_x);
  }
  </code></pre>
  
  <p><code>x</code> should be <code>Enu::X</code></p>