Macro assert_let_decrypted_state_event_content

Source
macro_rules! assert_let_decrypted_state_event_content {
    ($pat:pat = $event:expr, $($msg:tt)*) => { ... };
    ($pat:pat = $event:expr) => { ... };
}
Available on crate feature testing only.
Expand description

Given a TimelineEvent, assert that the event is a decrypted state event, and that its content matches the given pattern via a let binding.

If more than one argument is provided, these will be used as an error message if the content does not match the provided pattern.

ยงExamples

use matrix_sdk::assert_let_decrypted_state_event_content;

let room =
    client.get_room(&room_id).expect("Bob should have received the invite");

let event = room.event(&event_id, None).await?;

assert_let_decrypted_state_event_content!(
    ruma::events::AnyStateEventContent::RoomTopic(
        ruma::events::room::topic::RoomTopicEventContent { topic, .. }
    ) = event
);
assert_eq!(topic, "Encrypted topic!");