spawn

Function spawn 

Source
pub fn spawn<F, E>(fut: F) -> ManagedFuture
where F: Future<Output = Result<(), E>> + Send + 'static, E: Into<BoxError> + Send + 'static,
Expand description

Spawns a future ito its own Tokio task.

Use this in [ManagedProc::start_task] implementations when your future is Send + 'static. This is the preferred approach as it allows the process to run independently on the Tokio runtime.

§Example

impl ManagedProc for MyDaemon {
    fn run_proc(self: Box<Self>, shutdown: ShutdownSignal) -> ManagedFuture {
        super_visor::spawn(self.run(shutdown))
    }
}