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
When you derive on an enum, sometimes you want to implement some From<XXXNotFound> for some other error types, with maybe more explicit messages. It would be great if we could have an attribute that enables us to set the function that would be used to build the error from the original &str.
This would be so nice! I am parsing a big XML with Rust and many fields are implemented as Enum, it uses strong-xml crate and well, returning FromStr(VariantNotFound) isn't really helpful when I have already five different enums and need to know with one did failed when parsing it from String.
When you derive on an enum, sometimes you want to implement some
From<XXXNotFound>
for some other error types, with maybe more explicit messages. It would be great if we could have an attribute that enables us to set the function that would be used to build the error from the original&str
.e.g.
generating
If
parse_err_fn
is not specified butparse_err_ty
is, we could fallback onFrom<strum::ParseError>
.The text was updated successfully, but these errors were encountered: