pacman82 / atoi-rs

Parse integers directly from `[u8]` slices in safe code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Something more like `parse`

KillTheMule opened this issue · comments

Hey, thanks for this crate!

If you're inclined to offer more features, one thing I was missing was a trim-like feature. I needed to parse a byte string like b" 3 " into an integer, and this isn't quite directly doable with atoi. I implemented the trimming myself, but maybe you'd implement some more parse::&lt{Integer}&gt-like functionality.

Hello @KillTheMule , thanks for your feedback and sorry for taking so long to reply. Currently I feel that trimming is outside of the scope of atoi. Where are about 20 whitespace characters in Unicode, not all of them are one byte in utf-8. I do not want to open that can of worms. Also right now this crates assumes nothing more than an ASCII compatible encoding, which is also nice. While convinient, I think adding trimming to atoi would hurt its reusability.