pub trait MessageHandler:
Send
+ Sync
+ 'static {
// Required methods
fn on_message<'life0, 'async_trait>(
&'life0 self,
msg: Vec<u8>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn on_custom_message<'life0, 'async_trait>(
&'life0 self,
msg: Vec<u8>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn on_notice_message<'life0, 'async_trait>(
&'life0 self,
msg: Vec<u8>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn on_response<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 Response,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_ack_message<'life0, 'async_trait>(
&'life0 self,
msg: Vec<u8>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn on_data<'life0, 'async_trait>(
&'life0 self,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn supported_commands(&self) -> Vec<Command> { ... }
fn supports_command(&self, command: Command) -> bool { ... }
}Required Methods§
Sourcefn on_message<'life0, 'async_trait>(
&'life0 self,
msg: Vec<u8>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_message<'life0, 'async_trait>(
&'life0 self,
msg: Vec<u8>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
处理消息
Sourcefn on_custom_message<'life0, 'async_trait>(
&'life0 self,
msg: Vec<u8>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_custom_message<'life0, 'async_trait>(
&'life0 self,
msg: Vec<u8>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
处理自定义消息
Sourcefn on_notice_message<'life0, 'async_trait>(
&'life0 self,
msg: Vec<u8>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_notice_message<'life0, 'async_trait>(
&'life0 self,
msg: Vec<u8>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
处理通知消息
Sourcefn on_response<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 Response,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_response<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 Response,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
处理响应
Provided Methods§
Sourcefn supported_commands(&self) -> Vec<Command>
fn supported_commands(&self) -> Vec<Command>
获取支持的命令列表
Sourcefn supports_command(&self, command: Command) -> bool
fn supports_command(&self, command: Command) -> bool
检查是否支持某个命令