Trait hotshot_task::task::TaskState

source ·
pub trait TaskState: Send {
    type Event: TaskEvent + Clone + Send + Sync;

    // Required methods
    fn cancel_subtasks(&mut self);
    fn handle_event<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        event: Arc<Self::Event>,
        _sender: &'life1 Sender<Arc<Self::Event>>,
        _receiver: &'life2 Receiver<Arc<Self::Event>>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Type for mutable task state that can be used as the state for a Task

Required Associated Types§

source

type Event: TaskEvent + Clone + Send + Sync

Type of event sent and received by the task

Required Methods§

source

fn cancel_subtasks(&mut self)

Joins all subtasks.

source

fn handle_event<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, event: Arc<Self::Event>, _sender: &'life1 Sender<Arc<Self::Event>>, _receiver: &'life2 Receiver<Arc<Self::Event>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handles an event, providing direct access to the specific channel we received the event on.

Implementors§