Function atoi_radix10::parse [−][src]
pub fn parse<T>(s: &[u8]) -> Result<T, ParseIntErrorPublic> where
T: FromStrRadixHelper,
Expand description
Parses a UTF8 &u8 slice as a number.
Takes a &[u8]
because any non-utf/non-ascii will fail parsing as an integer.
It has exactly the same semantics as std::str::parse
,
but faster. (compiled with nightly,simd features
and target native cpu will get the absolute fastest result.)
Positives are slightly faster than negatives when parsing and
if you don’t need to put a leading +
then that will be faster too.
Examples
let s: String = "+000123".into(); assert_eq!(atoi_radix10::parse::<u8>(s.as_bytes()), Ok(123));