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

parse::<bool>() fails #53435

Closed
iotaaxel opened this issue Aug 16, 2018 · 2 comments
Closed

parse::<bool>() fails #53435

iotaaxel opened this issue Aug 16, 2018 · 2 comments

Comments

@iotaaxel
Copy link

fn parse() (from std::str::FromStr) is not working for a bool. I get an error regardless of whether I use "0" or "1".

@varkor
Copy link
Member

varkor commented Aug 16, 2018

I get an error regardless of whether I use "0" or "1".

The values with type bool are true and false. Their corresponding string representations are "true" and "false".

let t: bool = "true".parse().unwrap();
assert_eq!(t, true);

@iotaaxel
Copy link
Author

iotaaxel commented Aug 16, 2018

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants