Task

Trait Task 

Source
pub trait Task: Send + Sync {
    type H: Handler;

    // Required methods
    fn timer(&self) -> u64;
    fn run<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        state: &'life1 mut Self::H,
    ) -> Pin<Box<dyn Future<Output = Result<HandleResult<<Self::H as Handler>::Param>, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

Export useful types Timer tasks when game room started

Required Associated Types§

Source

type H: Handler

Game logic Handler

Required Methods§

Source

fn timer(&self) -> u64

Next time for execute the task

Source

fn run<'life0, 'life1, 'async_trait>( &'life0 mut self, state: &'life1 mut Self::H, ) -> Pin<Box<dyn Future<Output = Result<HandleResult<<Self::H as Handler>::Param>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Execute the task

Implementors§