title: Convert a String to int?
body: <p><strong>Note: this question contains deprecated pre-1.0 code! The answer is correct, though.</strong></p>
  
  <p>To convert a <code>str</code> to an <code>int</code> in Rust, I can do this:</p>
  
  <pre><code>let my_int = from_str::&lt;int&gt;(my_str);
  </code></pre>
  
  <p>The only way I know how to convert a <code>String</code> to an <code>int</code> is to get a slice of it and then use <code>from_str</code> on it like so:</p>
  
  <pre><code>let my_int = from_str::&lt;int&gt;(my_string.as_slice());
  </code></pre>
  
  <p>Is there a way to directly convert a <code>String</code> to an <code>int</code>?</p>