ResExt v0.7.0 - complete redesign #2
Tahaa-Dev
announced in
Announcements
Replies: 0 comments
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.
-
As of now, ResExt uses a trait-based API where you import the
ResExttrait andErrCtx<E>struct and use the methods provided by ResExt for error-handling similar to anyhow.But as it's clear from recent commits and updates to the repository, ResExt is trying to to start using a hybrid approach between thiserror and anyhow by providing the
enumerate! {}macro to generate error enums with ResExt implementations.The problem
This approach has hit a few issues in integration tests, specifically with the orphan rule (error E0117):
The solution
So in next versions, ResExt will be using a completely new approach for its types and traits, ResExt will use a new macro called
ResExt! { enum }instead of separate traits and types that generates:ResErrtype (similar toErrCtx<E>)ResExttrait with all of its methods and two implementations forResult<T, E>andResult<T, ResErr>Res<T>type alias with optional aliases instead ofResAll locally in your project!
Example
Error handling with ResExt v0.7.0+ would look like:
Why This Change?
While ResExt's priority is low-cost error handling, ergonomics still matter. This redesign achieves both:
Notes
Beta Was this translation helpful? Give feedback.
All reactions