Skip to content

Have From<&str> automatically provide FromStr #2143

Description

@mqudsi

Currently rust has both the traits std::str::FromStr and std::convert::From<T>, the latter of which is often implemented for T: String even when std::str::FromStr is not.

Can implementing std::str::From<String>/std::str::From<&str> provide a free implementation of std::convert::FromStr so that this problem is avoided? From<&str> (being exception-free) can be used to implement FromStr, even if the converse isn't true.

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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions