Skip to content

TryFrom and FromStr #1822

@clarfonthey

Description

@clarfonthey

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-libs-apiRelevant to the library API team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions