pub trait Handler: Send + Sized + 'static {
type Param: Param;
// Required methods
fn create<'life0, 'async_trait>(
peers: &'life0 [(Address, PeerId, [u8; 32])],
params: Vec<u8>,
rid: RoomId,
seed: [u8; 32],
) -> Pin<Box<dyn Future<Output = (Self, Tasks<Self>)> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
player: PeerId,
method: &'life1 str,
param: Self::Param,
) -> Pin<Box<dyn Future<Output = Result<HandleResult<Self::Param>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn accept<'life0, 'async_trait>(
_peers: &'life0 [(Address, PeerId, [u8; 32])],
) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send + 'async_trait>>
where 'life0: 'async_trait { ... }
fn online<'life0, 'async_trait>(
&'life0 mut self,
_player: PeerId,
) -> Pin<Box<dyn Future<Output = Result<HandleResult<Self::Param>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn offline<'life0, 'async_trait>(
&'life0 mut self,
_player: PeerId,
) -> Pin<Box<dyn Future<Output = Result<HandleResult<Self::Param>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Handle message received from players
Required Associated Types§
Required Methods§
sourcefn create<'life0, 'async_trait>(
peers: &'life0 [(Address, PeerId, [u8; 32])],
params: Vec<u8>,
rid: RoomId,
seed: [u8; 32],
) -> Pin<Box<dyn Future<Output = (Self, Tasks<Self>)> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create<'life0, 'async_trait>(
peers: &'life0 [(Address, PeerId, [u8; 32])],
params: Vec<u8>,
rid: RoomId,
seed: [u8; 32],
) -> Pin<Box<dyn Future<Output = (Self, Tasks<Self>)> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
create new room scan from chain
sourcefn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
player: PeerId,
method: &'life1 str,
param: Self::Param,
) -> Pin<Box<dyn Future<Output = Result<HandleResult<Self::Param>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
player: PeerId,
method: &'life1 str,
param: Self::Param,
) -> Pin<Box<dyn Future<Output = Result<HandleResult<Self::Param>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
handle message in a room
Provided Methods§
sourcefn accept<'life0, 'async_trait>(
_peers: &'life0 [(Address, PeerId, [u8; 32])],
) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send + 'async_trait>>where
'life0: 'async_trait,
fn accept<'life0, 'async_trait>(
_peers: &'life0 [(Address, PeerId, [u8; 32])],
) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send + 'async_trait>>where
'life0: 'async_trait,
accept params when submit to chain
Object Safety§
This trait is not object safe.