Trait usiagent::event::EventDispatcher [−][src]
pub trait EventDispatcher<'b, K, E, T, UE> where
K: MaxIndex + Debug,
E: MapEventKind<K> + Debug,
UE: PlayerError,
EventHandlerError<K, UE>: From<UE>,
usize: From<K>, {
fn add_handler<F>(&mut self, id: K, handler: F)
where
F: FnMut(&T, &E) -> Result<(), EventHandlerError<K, UE>> + 'b;
fn add_once_handler<F>(&mut self, id: K, handler: F)
where
F: FnMut(&T, &E) -> Result<(), EventHandlerError<K, UE>> + 'b;
fn dispatch_events<'a>(
&mut self,
ctx: &T,
event_queue: &'a Mutex<EventQueue<E, K>>
) -> Result<(), EventDispatchError<'a, EventQueue<E, K>, E, UE>>
where
E: Debug,
K: Debug,
UE: Error + Debug,
EventHandlerError<K, UE>: From<UE>,
usize: From<K>;
}
Expand description
イベントディスパッチャ
Required methods
fn add_handler<F>(&mut self, id: K, handler: F) where
F: FnMut(&T, &E) -> Result<(), EventHandlerError<K, UE>> + 'b,
fn add_handler<F>(&mut self, id: K, handler: F) where
F: FnMut(&T, &E) -> Result<(), EventHandlerError<K, UE>> + 'b,
イベントハンドラの追加
Arguments
id
- イベント種別handler
- イベントハンドラ
Errors
この関数は以下のエラーを返すケースがあります。
EventHandlerError
手が合法手でない
fn add_once_handler<F>(&mut self, id: K, handler: F) where
F: FnMut(&T, &E) -> Result<(), EventHandlerError<K, UE>> + 'b,
fn add_once_handler<F>(&mut self, id: K, handler: F) where
F: FnMut(&T, &E) -> Result<(), EventHandlerError<K, UE>> + 'b,
一度だけ実行されるイベントハンドラの追加
Arguments
id
- イベント種別handler
- イベントハンドラ
Errors
この関数は以下のエラーを返すケースがあります。
EventHandlerError
手が合法手でない
fn dispatch_events<'a>(
&mut self,
ctx: &T,
event_queue: &'a Mutex<EventQueue<E, K>>
) -> Result<(), EventDispatchError<'a, EventQueue<E, K>, E, UE>> where
E: Debug,
K: Debug,
UE: Error + Debug,
EventHandlerError<K, UE>: From<UE>,
usize: From<K>,
fn dispatch_events<'a>(
&mut self,
ctx: &T,
event_queue: &'a Mutex<EventQueue<E, K>>
) -> Result<(), EventDispatchError<'a, EventQueue<E, K>, E, UE>> where
E: Debug,
K: Debug,
UE: Error + Debug,
EventHandlerError<K, UE>: From<UE>,
usize: From<K>,
イベントのディスパッチ
Arguments
ctx
- コンテキストオブジェクトevent_queue
- イベントキュー
Errors
この関数は以下のエラーを返すケースがあります。
EventDispatchError
手が合法手でない