Does Rust provide a way to parse integer numbers directly from ASCII data in byte (u8) arrays?
<p>Rust has <a href="https://doc.rust-lang.org/std/str/trait.FromStr.html#tymethod.from_str" rel="noreferrer"><code>FromStr</code></a>, however as far as I can see this only takes Unicode text input. Is there an equivalent to this for <code>[u8]</code> arrays?</p>

<p>By "parse" I mean take ASCII characters and return an integer, like C's <code>atoi</code> does.</p>

<p>Or do I need to either...</p>

<ul>
<li>Convert the <code>u8</code> array to a string first, then call <code>FromStr</code>.</li>
<li>Call out to libc's <code>atoi</code>.</li>
<li>Write an <code>atoi</code> in Rust.</li>
</ul>

<p>In nearly all cases the first option is reasonable, however there are cases where files maybe be very large, with no predefined encoding... or contain mixed binary and text, where its most straightforward to read integer numbers as bytes.</p>