/// Spawns a new asynchronous task wrapping it to be supervised by the task manager.
/// Method can return [`None`] if task manager is full and task can not be spawned yet
/// otherwise it returns task key that can be used to cancel this task.
Spawns a new asynchronous task wrapping it to be supervised by the task manager.
Method can return [`None`] if task manager is full and task can not be spawned yet
otherwise it returns task key that can be used to cancel this task.
Spawns a new asynchronous task wrapping it to be supervised by the task manager . Method can return [ ` None ` ] if task manager is full and task can not be spawned yet otherwise it returns task key that can be used to cancel this task .
pub fn try_spawn<F>(&mut self, future: F) -> Option<usize>
    where
        F: Future<Output = ()> + Send + 'static,
    {
        if self.tasks.len() == self.max_tasks {
            return None;
        }
        let task_entry = self.tasks.vacant_entry();
        let task_key = task_entry.key();
        let completion_event_queue_sender = self.completion_event_queue_sender.clone();
        let task_handle = spawn_inner(future, async move {
            let _ = completion_event_queue_sender.send(task_key).await;
        });
        task_entry.insert(task_handle);
        return Some(task_key);
    }
pub fn try_spawn < F > ( & mut self , future : F ) -> Option < usize > where F : Future < Output = ( ) > + Send + ' static , { if self . tasks . len ( ) == self . max_tasks { return None ; } let task_entry = self . tasks . vacant_entry ( ) ; let task_key = task_entry . key ( ) ; let completion_event_queue_sender = self . completion_event_queue_sender . clone ( ) ; let task_handle = spawn_inner ( future , async move { let _ = completion_event_queue_sender . send ( task_key ) . await ; } ) ; task_entry . insert ( task_handle ) ; return Some ( task_key ) ; }
Spawns a new asynchronous task wrapping it to be supervised by the task manager.
Spawns a new asynchronous task wrapping it to be supervised by the task manager .
&mut self
future
F