Hacker News new | past | comments | ask | show | jobs | submit login

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.



Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: