Module matrix_sdk::event_handler

source ·
Expand description

Types and traits related for event handlers. For usage, see Client::add_event_handler.

§How it works

The add_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 / .awaiting 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§

Traits§