diff --git a/testing/matrix-sdk-test/src/event_factory.rs b/testing/matrix-sdk-test/src/event_factory.rs index d5cec598a..cb1e1e2fa 100644 --- a/testing/matrix-sdk-test/src/event_factory.rs +++ b/testing/matrix-sdk-test/src/event_factory.rs @@ -57,8 +57,9 @@ use ruma::{ topic::RoomTopicEventContent, }, typing::TypingEventContent, - AnySyncTimelineEvent, AnyTimelineEvent, BundledMessageLikeRelations, EventContent, - RedactedMessageLikeEventContent, RedactedStateEventContent, + AnyStateEvent, AnySyncStateEvent, AnySyncTimelineEvent, AnyTimelineEvent, + BundledMessageLikeRelations, EventContent, RedactedMessageLikeEventContent, + RedactedStateEventContent, StateEventContent, }, serde::Raw, server_name, EventId, Int, MilliSecondsSinceUnixEpoch, MxcUri, OwnedEventId, OwnedMxcUri, @@ -441,6 +442,24 @@ where } } +impl From> for Raw +where + E::EventType: Serialize, +{ + fn from(val: EventBuilder) -> Self { + Raw::new(&val.construct_json(false)).unwrap().cast() + } +} + +impl From> for Raw +where + E::EventType: Serialize, +{ + fn from(val: EventBuilder) -> Self { + Raw::new(&val.construct_json(true)).unwrap().cast() + } +} + #[derive(Debug, Default)] pub struct EventFactory { next_ts: AtomicU64,