Function zng_task::run_catch

source ·
pub async fn run_catch<R, T>(task: T) -> Result<R>
where R: Send + 'static, T: Future<Output = R> + Send + 'static,
Expand description

Like run but catches panics.

This task works the same and has the same utility as run, except if returns panic messages as an error instead of propagating the panic.

§Unwind Safety

This function disables the unwind safety validation, meaning that in case of a panic shared data can end-up in an invalid, but still memory safe, state. If you are worried about that only use poisoning mutexes or atomics to mutate shared data or discard all shared data used in the task if this function returns an error.