Replies: 1 comment 7 replies
-
|
Or better, generate this definition, which is a bit more versatile. pub type XYZResult<T, E = XYZError> = std::result::Result<T, E>;Personally I wouldn't be opposed to introducing that as an opt-in, so that it is not a semver breaking change. This would also make an opportunity for the caller to override the resulting type (no pun intended). It'd be used somewhat like this: #[derive(Debug, Snafu)]
#[snafu(result)] // creates pub type `XYZResult`
pub enum XYZError {
// ...
}or this (if we want to support overriding the name): #[derive(Debug, Snafu)]
#[snafu(result(XYZResult))]
pub enum XYZError {
// ...
}I have many places were I just name it |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Every single error in my codebase looks like this:
Could
Snafujust generate the Result alias? :D . I know I'm lazy, but isn't that the whole point? :DBeta Was this translation helpful? Give feedback.
All reactions