Show Option<EncryptionInfo> event handler context in doc example

This commit is contained in:
Jonas Platte 2021-09-10 17:12:17 +02:00
parent 24253128ae
commit d6d51ef4b1
No known key found for this signature in database
GPG key ID: CC154DE0E30B7C67

View file

@ -923,6 +923,7 @@ impl Client {
/// ```no_run
/// # let client: matrix_sdk::Client = unimplemented!();
/// use matrix_sdk::{
/// deserialized_responses::EncryptionInfo,
/// room::Room,
/// ruma::{
/// events::{
@ -940,13 +941,22 @@ impl Client {
/// # let _ = async {
/// client
/// .register_event_handler(
/// |ev: SyncMessageEvent<MessageEventContent>, room: Room, client: Client| async move {
/// |ev: SyncStateEvent<TopicEventContent>, room: Room, client: Client| async move {
/// // Common usage: Room event plus room and client.
/// },
/// )
/// .await
/// .register_event_handler(
/// |ev: SyncMessageEvent<MessageEventContent>,
/// room: Room,
/// encryption_info: Option<EncryptionInfo>| async move {
/// // An `Option<EncryptionInfo>` parameter lets you distinguish between
/// // unencrypted events and events that were decrypted by the SDK.
/// },
/// )
/// .await
/// .register_event_handler(|ev: SyncStateEvent<TopicEventContent>| async move {
/// // Also possible: Omit any or all arguments after the first.
/// // You can omit any or all arguments after the first.
/// })
/// .await;
///