My Q is, given the example above, how to propagate the error from handle_copy, instead of .unwrap()ing it? The closure shall return EventLoopError in case of failure, however that's not a suitable error type for my situation, where I parse stuff.
Thank you!
You cannot do what you're asking for. In fact, even when the surrounding function returns, your closure might not have yet executed. Slint stores the closure for execution at some point, which might happen after the surrounding function returns.
Thank you for the help! I felt like I try to do something impossible, thanks for confirming there isn't another way. In fact my lambda is more complicated than a single function call, and the parsing which might fail is done only when some conditions say so. I'll leave it for now the way it is, with doing operations which might fail first and passing their results to the lambda.