Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parsing related functions and traits. #65

Closed
MashPlant opened this issue Jun 22, 2020 · 1 comment
Closed

Add parsing related functions and traits. #65

MashPlant opened this issue Jun 22, 2020 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@MashPlant
Copy link

In the str type, we have:

pub fn parse<F>(&self) -> Result<F, <F as FromStr>::Err>
where
    F: FromStr, 

Sometimes I just want to parse a u32 from a byte slice, but currently when working with std lib, I can only first perform checked convert from & [u8] it to & str, and then call str::parse. It would be a performance loss, because I don't really care whether this byte slice is a valid UTF-8 string.

Is it possible to add similiar functions and traits in bstr?

@BurntSushi
Copy link
Owner

This appears to be a duplicate of #64, which was created just a few hours before this one.

@BurntSushi BurntSushi added the duplicate This issue or pull request already exists label Jun 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants