events: Add constructor for events::room::encrypted::Replacement

This commit is contained in:
Kévin Commaille 2022-11-25 18:24:10 +01:00
parent dc18b12506
commit 03230013d9
No known key found for this signature in database
GPG Key ID: DD507DAE96E8245C

View File

@ -138,10 +138,17 @@ impl<C> From<message::Relation<C>> for Relation {
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct Replacement { pub struct Replacement {
/// The ID of the event being replacing. /// The ID of the event being replaced.
pub event_id: OwnedEventId, 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. /// A reference to another event.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]