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
{{ message }}
Repository navigation
Allow extra fields when using #[from] (using Default trait) #441
It would be useful to allow extra fields in the structs when using #[from], to optionally add additional context. I think that could be achieved by simply initializing them with Default::default() in the From implementation, and allowing user to add the context to errors later (e.g. with another derive macro from a different crate).
I could provide a PR that implement it, but I saw from some previous issues that you're somewhat against the idea of supporting adding context to the errors, so I want to make sure you're on board with this before I spend more time on it.
I believe that my proposal is minimally intrusive, and maintains the spirit of simplicity of this crate. If this would stray too much from the current interface, how about adding optional parameter to #[from], e.g. #[from(with_defaults)], that would trigger this behavior?
Activity