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

TryFrom and FromStr #1822

Closed
clarfonthey opened this issue Dec 19, 2016 · 1 comment
Closed

TryFrom and FromStr #1822

clarfonthey opened this issue Dec 19, 2016 · 1 comment
Labels
T-libs-api Relevant to the library API team, which will review and decide on the RFC.

Comments

@clarfonthey
Copy link

Right now, it seems like a blanket TryFrom could be implemented for everything that implements FromStr:

impl<'a, T: FromStr> TryFrom<&'a str> for T {
    type Err = <T as FromStr>::Err;
    fn try_from(s: &'a s) -> Result<T, Self::Err> {
        T::from_str(s)
    }
}

This seems like something that should be reconciled. It'd be very confusing if anything implemented TryFrom<&'a str> and FromStr and didn't have the same implementation for both.

@nrc nrc added the T-libs-api Relevant to the library API team, which will review and decide on the RFC. label Jan 4, 2017
@clarfonthey
Copy link
Author

Closing in favour of just adding a comment to rust-lang/rust#33417

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-libs-api Relevant to the library API team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

2 participants