From 03230013d9116c713ff776c781719b0ac1b38722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Fri, 25 Nov 2022 18:24:10 +0100 Subject: [PATCH] events: Add constructor for events::room::encrypted::Replacement --- crates/ruma-common/src/events/room/encrypted.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/ruma-common/src/events/room/encrypted.rs b/crates/ruma-common/src/events/room/encrypted.rs index c8d22f9e..3b054988 100644 --- a/crates/ruma-common/src/events/room/encrypted.rs +++ b/crates/ruma-common/src/events/room/encrypted.rs @@ -138,10 +138,17 @@ impl From> for Relation { #[derive(Clone, Debug, Deserialize, Serialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct Replacement { - /// The ID of the event being replacing. + /// The ID of the event being replaced. pub event_id: OwnedEventId, } +impl Replacement { + /// Creates a new `Replacement` with the given event ID. + pub fn new(event_id: OwnedEventId) -> Self { + Self { event_id } + } +} + /// A reference to another event. #[derive(Clone, Debug, Deserialize, Serialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]