Create a Task factory that will be used to respawn a new task, if the running one fails.
impl FutureFactory
to define how the task will be respawned.
impl ErrorHandler
to customize error handling.
Call make_future_respawnable
to put your factory to work, with the error handler.
```rust struct TaskReturnsResult;
impl FutureFactory
let factory = TaskReturnsResult;
let handler = AlwaysRespawnAndTrace { duration: std::time::Duration::from_millis(1), };
let joinhandle = tokio::spawn(makefuture_respawnable(handler, factory));
sleep(Duration::from_millis(10)).await;
join_handle.abort();
let err = joinhandle.await.unwraperr(); assert!(!err.ispanic(), "{:?}", err); assert!(err.iscancelled(), "{:?}", err); ```