You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have functions with signature pub(crate) fn new_unchecked<A: AsRef<str>>(value: A) -> Self on a number of enums, where the function converts any string to an enum variant and unrecognized strings go to the Unknown(String) variant.
It seems it would be more convenient and idiomatic to just impl From<&str> or impl FromStr instead of using a custom function. The generic A: AsRef<str> will be separately monomorphised for every type it is used with, increasing compilation time and binary size.
A potentially significant change is that trait implementations are automatically public, so there is no way to make them pub(crate). But exposing it publicly actually sounds like a good idea to me.
I originally brought this up in the review of #681
The text was updated successfully, but these errors were encountered:
We have functions with signature
pub(crate) fn new_unchecked<A: AsRef<str>>(value: A) -> Self
on a number of enums, where the function converts any string to an enum variant and unrecognized strings go to theUnknown(String)
variant.It seems it would be more convenient and idiomatic to just
impl From<&str>
orimpl FromStr
instead of using a custom function. The genericA: AsRef<str>
will be separately monomorphised for every type it is used with, increasing compilation time and binary size.A potentially significant change is that trait implementations are automatically public, so there is no way to make them
pub(crate)
. But exposing it publicly actually sounds like a good idea to me.I originally brought this up in the review of #681
The text was updated successfully, but these errors were encountered: