{"action":"created","issue":{"url":"https://api.github.com/repos/kevincox/humanbool.rs/issues/1","repository_url":"https://api.github.com/repos/kevincox/humanbool.rs","labels_url":"https://api.github.com/repos/kevincox/humanbool.rs/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/kevincox/humanbool.rs/issues/1/comments","events_url":"https://api.github.com/repos/kevincox/humanbool.rs/issues/1/events","html_url":"https://github.com/kevincox/humanbool.rs/issues/1","id":167796118,"number":1,"title":"FromStr and Deref","user":{"login":"killercup","id":20063,"avatar_url":"https://avatars.githubusercontent.com/u/20063?v=3","gravatar_id":"","url":"https://api.github.com/users/killercup","html_url":"https://github.com/killercup","followers_url":"https://api.github.com/users/killercup/followers","following_url":"https://api.github.com/users/killercup/following{/other_user}","gists_url":"https://api.github.com/users/killercup/gists{/gist_id}","starred_url":"https://api.github.com/users/killercup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killercup/subscriptions","organizations_url":"https://api.github.com/users/killercup/orgs","repos_url":"https://api.github.com/users/killercup/repos","events_url":"https://api.github.com/users/killercup/events{/privacy}","received_events_url":"https://api.github.com/users/killercup/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-27T08:12:25Z","updated_at":"2016-07-27T13:12:11Z","closed_at":null,"body":"I think you could make a newtype wrapper around `bool` and implement `FromStr` (with your custom error type) and `Deref` (to get a bool and call boolean methods) on it."},"comment":{"url":"https://api.github.com/repos/kevincox/humanbool.rs/issues/comments/235580175","html_url":"https://github.com/kevincox/humanbool.rs/issues/1#issuecomment-235580175","issue_url":"https://api.github.com/repos/kevincox/humanbool.rs/issues/1","id":235580175,"user":{"login":"killercup","id":20063,"avatar_url":"https://avatars.githubusercontent.com/u/20063?v=3","gravatar_id":"","url":"https://api.github.com/users/killercup","html_url":"https://github.com/killercup","followers_url":"https://api.github.com/users/killercup/followers","following_url":"https://api.github.com/users/killercup/following{/other_user}","gists_url":"https://api.github.com/users/killercup/gists{/gist_id}","starred_url":"https://api.github.com/users/killercup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killercup/subscriptions","organizations_url":"https://api.github.com/users/killercup/orgs","repos_url":"https://api.github.com/users/killercup/repos","events_url":"https://api.github.com/users/killercup/events{/privacy}","received_events_url":"https://api.github.com/users/killercup/received_events","type":"User","site_admin":false},"created_at":"2016-07-27T13:12:11Z","updated_at":"2016-07-27T13:12:11Z","body":"I don't think that's possible – you always need to specify the type you want to convert your string to.\r\n\r\nAssuming you impl FromStr for a type `struct HumanBool(bool)`, you need to write `HumanBool::from_str(\"y\")`. If you also `impl Deref for HumanBool` with `Target = bool`, you can then `let answer = *HumanBool::from_str(\"y\");`. (I didn't test this, though.)"}}
{"actor":{"display_login":"killercup"}}