-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Result alias for convienient use of anyhow::Error without depending on anyhow #5853
Conversation
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 fine with this, Alex what do you think?
Subscribe to Label Actioncc @peterhuene
This issue or pull request has been labeled: "wasmtime:api"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
Subscribe to Label Actioncc @fitzgen
This issue or pull request has been labeled: "fuzzing"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
@alexcrichton I applied your suggestion! |
As discussed on Zulip, the
bindgen!
macro assumes the usage ofanyhow
. This adds a type alias towasmtime
forstd::result::Result<T, anyhow::Error>
that allows users to usewasmtime::Result
where astd::result::Result<T, anyhow::Error>
is expected.In particular, this means that users of
bindgen!
can usewasmtime::Result
when they are implementing an import function.One caveat: after making this change, I realized that the
bindgen!
macro has thetrappable_error_type
option which could be used to change the error type assume. While some changes need to be made no matter what (as many of the methods generated by the macro still assumeanyhow
and don't respect that option), we might want to consider not adding this type alias and just making it clearer that users should use thetrappable_error_type
option if they are not usinganyhow
.r? @alexcrichton