stringly_conversions

Macro impl_try_from_stringly

Source
macro_rules! impl_try_from_stringly {
    ($to:ty $(, $from:ty)+ $(,)?) => { ... };
    (@std, $to:ty $(, $from:ty)+ $(,)?) => { ... };
}
Expand description

impls TryFrom where T: Deref<Target=str> in terms of FromStr.

If your type implements FromStr then it could also implement TryFrom<T> where T are various stringly types like &str, String, Cow<'a, str>… Implementing these conversions as a blanket impl is impossible due to the conflict with T: Into<Self>. Implementing them manually is tedious. This macro will help you. However, take a look at impl_into_stringly_standard which will help you even more!

This needs to be a macro instead of blanket imple in order to resolve the conflict with T: Into