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
There is an issue that took me a while to understand, and it's that in the lib doc is not very clear how to display the error that is being derived with #[from] macro.
The actual example is e.g.
#[error("data store disconnected")]Disconnect(#[from] io::Error)
Despite there is also an example of how to use from attribute over a struct field e.g.
Even though it works, should this be encouraged by the documentation? I don't think that this is the idiomatic way to print this error. Using #from automatically implements source; then this error should be printed like:
Activity
PSteinhaus commentedon Jul 4, 2021
Thank you, I pretty much looked at the repo just hoping to find something like this.
Altair-Bueno commentedon Sep 7, 2021
Took me a while to figure it out too. Should be included on README
DJDuque commentedon Aug 2, 2022
Even though it works, should this be encouraged by the documentation? I don't think that this is the idiomatic way to
printthis error. Using#fromautomatically implementssource; then this error should be printed like:I guess this is how most people would expect this to behave, and they would get:
Maybe an example using
sourceis more appropriate?failable commentedon Jun 15, 2024
Any answer from 2024?