Email
may implement From<String>
, but Option<Email>
does not implement From<Option<String>>
(as your title says). Email
and Option<Email>
are distinct types. Since you can't implement a foreign trait on a foreign type, just implmenting From<Option<String>>
for Option<Email>
is off the table, unfortunately. As an alternative, maybe you can add another layer of wrapping with a struct MaybeEmail(Option<Email>)
and derive From<Option<String>>
for that (maybe manually instead of using derive_more
).
1 Like