How weird would it be to have an API that returns a Result<Result<&mut Self, Trap>>
?
I guess, we already have Func::call
which converts the Trap
into an Error
, so maybe that's better.
Really weird. Will downcast
not work for outer error?
Yeah, I think that's the better way. Use anyhow::Error, and just have users downcast to Trap when needed
@Dan Gohman Found this thread rather late, but: the other way to do that would be a thiserror type with one branch for Trap and another for other errors.
Then it's a simple match rather than a downcast.
Last updated: Dec 23 2024 at 14:03 UTC