Module matrix_sdk::event_handler
source · [−]Expand description
Types and traits related for event handlers. For usage, see
Client::register_event_handler
.
How it works
The register_event_handler
method registers event handlers of different
signatures by actually storing boxed closures that all have the same
signature of async (EventHandlerData) -> ()
where EventHandlerData
is a
private type that contains all of the data an event handler might need.
The stored closure takes care of deserializing the event which the
EventHandlerData
contains as a (borrowed) serde_json::value::RawValue
,
extracting the context arguments from other fields of EventHandlerData
and
calling / .await
ing the event handler if the previous steps succeeded.
It also logs any errors from the above chain of function calls.
For more details, see the EventHandler
trait.
Structs
A custom value registered with
.register_event_handler_context
.
The raw JSON form of an event.
Traits
Interface for event handlers.
Context for an event handler.
Return types supported for event handlers implement this trait.
A statically-known event kind/type that can be retrieved from an event sync.