pub trait EventHandler: Send + Sync {
// Required methods
fn handle<'life0, 'async_trait>(
&'life0 self,
event: EventData,
) -> Pin<Box<dyn Future<Output = WaeResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn event_types(&self) -> Vec<EventTypeName> ⓘ;
}Expand description
事件处理器 trait (异步)
定义异步事件处理器的接口。
Required Methods§
Sourcefn handle<'life0, 'async_trait>(
&'life0 self,
event: EventData,
) -> Pin<Box<dyn Future<Output = WaeResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle<'life0, 'async_trait>(
&'life0 self,
event: EventData,
) -> Pin<Box<dyn Future<Output = WaeResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
处理事件
Sourcefn event_types(&self) -> Vec<EventTypeName> ⓘ
fn event_types(&self) -> Vec<EventTypeName> ⓘ
获取处理器感兴趣的事件类型