Stream: wasmtime

Topic: results of results?


view this post on Zulip Dan Gohman (May 22 2020 at 19:28):

How weird would it be to have an API that returns a Result<Result<&mut Self, Trap>>?

view this post on Zulip Dan Gohman (May 22 2020 at 19:30):

I guess, we already have Func::call which converts the Trap into an Error, so maybe that's better.

view this post on Zulip Yury Delendik (May 22 2020 at 19:30):

Really weird. Will downcastnot work for outer error?

view this post on Zulip Dan Gohman (May 22 2020 at 19:34):

Yeah, I think that's the better way. Use anyhow::Error, and just have users downcast to Trap when needed

view this post on Zulip Josh Triplett (Aug 08 2020 at 16:36):

@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.

view this post on Zulip Josh Triplett (Aug 08 2020 at 16:36):

Then it's a simple match rather than a downcast.


Last updated: Dec 23 2024 at 14:03 UTC