3 ms·
There are safe interfaces for this stuff too. The byteorder crate (not in the standard library, but widely used) has: let i = NativeEndian::read_i64(...);
by oconnor663 9y ago
There are safe interfaces for this stuff too. The byteorder crate (not in the standard library, but widely used) has:
let i = NativeEndian::read_i64(...);
Or if you're literally parsing a string of digits:
let i: Option<i64> = digits.parse();
The `parse` method on strings is a particularly smooth piece of trait system magic.