3 ms·
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
by saghm 1y ago
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).