pub fn spawn<Fut>(&mut self, future: Fut) -> &mut Self
    where
        Fut: Future<Output = Result<(), PoolError>> + Send + 'static,
    {
        let (tx, rx) = unbounded::<()>();
        self.stop_senders.push(tx);
        let control = self.control_sender.clone();
        self.pool.spawn_ok(async move {
            let future = future.fuse();
            let stopped = rx.recv().fuse();
            pin_mut!(future, stopped);
            let _ = select! {
                output = future => control.send(output).await,
                _ = stopped => control.send(Ok(())).await
            };
        });
        self
    }
/// Start executing a future right away.
Start executing a future right away.
Start executing a future right away .
pub fn spawn<Fut>(&mut self, future: Fut) -> &mut Self
    where
        Fut: Future<Output = Result<(), PoolError>> + Send + 'static,
    {
        let (tx, rx) = unbounded::<()>();
        self.stop_senders.push(tx);
        let control = self.control_sender.clone();
        self.pool.spawn_ok(async move {
            let future = future.fuse();
            let stopped = rx.recv().fuse();
            pin_mut!(future, stopped);
            let _ = select! {
                output = future => control.send(output).await,
                _ = stopped => control.send(Ok(())).await
            };
        });
        self
    }
pub fn spawn < Fut > ( & mut self , future : Fut ) -> & mut Self where Fut : Future < Output = Result < ( ) , PoolError > > + Send + ' static , { let ( tx , rx ) = unbounded :: < ( ) > ( ) ; self . stop_senders . push ( tx ) ; let control = self . control_sender . clone ( ) ; self . pool . spawn_ok ( async move { let future = future . fuse ( ) ; let stopped = rx . recv ( ) . fuse ( ) ; pin_mut ! ( future stopped ) ; let _ = select ! { output future control send ( output ) await stopped control send ( Ok ( ( ) ) ) await } ; } ) ; self }
Start executing a future right away.
Start executing a future right away .
&mut self
future
Fut