-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add TryFrom for GethTrace for all inner variants #933
feat: add TryFrom for GethTrace for all inner variants #933
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with the tryfrom impls, but I personally would prefer gethtrace functions instead, so you can do something like:
let trace = provider.trace(..).await?.try_into_default()?;
without providing type hints, but we can do both, tryfrom and the functions
This comment was marked as resolved.
This comment was marked as resolved.
@mattsse please have a look again. PS: If you wonder why the clippy fixes: I used the command from the |
… match the returning type
I gave the topic a fresh look and came to the conclusion that the TryFrom implementation is redundant at all. From api perspective you initial idea has a better flow and and is easier to use. I adapted the naming of the variants in the function names. My feeling is that it is much better to have the full type name in there. It is easier to read without IDE type hinting and does not maybe lead to a mixup with e.g. Default(). @mattsse feel free to have a look again |
* feat: add TryFrom for GethTrace for all inner variants * Use workspace version for thiserror * Fix clippy findings * Simplify error * Add functions for try_into_{tracer-variant} for GethTrace * Fix clippy findings * Update changelog * Typo * Fix clippy findings * Remove redundant TryFrom implementation and rename try_into method to match the returning type
Fixes #929
For me it feels more rust like to use
{variant}::try_from(geth_trace)
instead ofgeth_trace.try_into_{variant}()
. How do you feel about that @mattsse?Example: