Re:Designing Error Types in Rust Libraries
by saghm on Monday June 02, 2025 @12:28PM
(#44160478)
This also gives the flexibility to easily change your decision later if you determine that it's important to expose the inner type for some reason. With a boxed trait error type, you'd only be able to by adding a new method to one of the traits, and the implementation would be a lot messier with downcasting, (and unwrapping if you wanted to avoid the optional, which could open the door to bugs where you accidentally don't have the error type you expect and then panic).
[ Parent
| on HN ]
There are no comments on this comment yet.