pub trait ClientEventHandler: Send + Sync {
// Provided methods
fn handle_system_command<'life0, 'life1, 'async_trait>(
&'life0 self,
command_type: SysType,
frame: &'life1 Frame,
) -> Pin<Box<dyn Future<Output = Result<Option<Frame>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_message_command<'life0, 'life1, 'async_trait>(
&'life0 self,
command_type: PayloadType,
frame: &'life1 Frame,
) -> Pin<Box<dyn Future<Output = Result<Option<Frame>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_notification_command<'life0, 'life1, 'async_trait>(
&'life0 self,
command_type: NotifType,
frame: &'life1 Frame,
) -> Pin<Box<dyn Future<Output = Result<Option<Frame>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_connection_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 ConnectionEvent,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
客户端事件处理器
允许用户实现自定义逻辑来处理不同类型的客户端事件和命令
所有方法都有默认实现,用户只需要实现需要的方法即可
Provided Methods§
Sourcefn handle_system_command<'life0, 'life1, 'async_trait>(
&'life0 self,
command_type: SysType,
frame: &'life1 Frame,
) -> Pin<Box<dyn Future<Output = Result<Option<Frame>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_system_command<'life0, 'life1, 'async_trait>(
&'life0 self,
command_type: SysType,
frame: &'life1 Frame,
) -> Pin<Box<dyn Future<Output = Result<Option<Frame>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn handle_message_command<'life0, 'life1, 'async_trait>(
&'life0 self,
command_type: PayloadType,
frame: &'life1 Frame,
) -> Pin<Box<dyn Future<Output = Result<Option<Frame>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_message_command<'life0, 'life1, 'async_trait>(
&'life0 self,
command_type: PayloadType,
frame: &'life1 Frame,
) -> Pin<Box<dyn Future<Output = Result<Option<Frame>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
处理载荷命令(MESSAGE/EVENT/ACK/DATA)
Sourcefn handle_notification_command<'life0, 'life1, 'async_trait>(
&'life0 self,
command_type: NotifType,
frame: &'life1 Frame,
) -> Pin<Box<dyn Future<Output = Result<Option<Frame>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_notification_command<'life0, 'life1, 'async_trait>(
&'life0 self,
command_type: NotifType,
frame: &'life1 Frame,
) -> Pin<Box<dyn Future<Output = Result<Option<Frame>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn handle_connection_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 ConnectionEvent,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_connection_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 ConnectionEvent,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".