pub fn spawn(&self, task: impl Future<Output = ()> + Send + 'static, name: &'static str) {
        let exit = self.exit.clone();
        let log = self.log.clone();
        // Task is shutdown before it completes if `exit` receives
        let future = future::select(Box::pin(task), exit).then(move |either| {
            match either {
                future::Either::Left(_) => trace!(log, "Async task completed"; "task" => name),
                future::Either::Right(_) => {
                    debug!(log, "Async task shutdown, exit received"; "task" => name)
                }
            }

            futures::future::ready(())
        });
        self.handle.spawn(future);
    }
/// Spawn a future on the tokio runtime wrapped in an `exit_future::Exit`. The task is canceled
/// when the corresponding exit_future `Signal` is fired/dropped.
///
/// This function generates prometheus metrics on number of tasks and task duration.
Spawn a future on the tokio runtime wrapped in an `exit_future::Exit`. The task is canceled
when the corresponding exit_future `Signal` is fired/dropped.

This function generates prometheus metrics on number of tasks and task duration.
Spawn a future on the tokio runtime wrapped in an ` exit_future :: Exit ` . The task is canceled when the corresponding exit_future ` Signal ` is fired / dropped . This function generates prometheus metrics on number of tasks and task duration .
pub fn spawn(&self, task: impl Future<Output = ()> + Send + 'static, name: &'static str) {
        let exit = self.exit.clone();
        let log = self.log.clone();
        // Task is shutdown before it completes if `exit` receives
        let future = future::select(Box::pin(task), exit).then(move |either| {
            match either {
                future::Either::Left(_) => trace!(log, "Async task completed"; "task" => name),
                future::Either::Right(_) => {
                    debug!(log, "Async task shutdown, exit received"; "task" => name)
                }
            }
            futures::future::ready(())
        });
        self.handle.spawn(future);
    }
pub fn spawn ( & self , task : impl Future < Output = ( ) > + Send + ' static , name : & ' static str ) { let exit = self . exit . clone ( ) ; let log = self . log . clone ( ) ; // Task is shutdown before it completes if `exit` receives let future = future :: select ( Box :: pin ( task ) , exit ) . then ( move | either | { match either { future :: Either :: Left ( _ ) => trace ! ( log " " " " name ) , future :: Either :: Right ( _ ) => { debug ! ( log " " " " name ) } } futures :: future :: ready ( ( ) ) } ) ; self . handle . spawn ( future ) ; }
Spawn a future on the tokio runtime wrapped in an `exit_future::Exit`.
Spawn a future on the tokio runtime wrapped in an ` exit_future :: Exit ` .
&self
task
impl Future<Output = ()> + Send + 'static
name
&'static str
&self
task
impl Future<Output = ()> + Send + 'static
name
&'static str