events: Add Serialize back to InitialStateEvent

This commit is contained in:
Zwelf 2023-01-24 17:04:47 +01:00 committed by GitHub
parent c79f9a97e1
commit 3d74117dd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -314,6 +314,19 @@ pub struct InitialStateEvent<C: StaticStateEventContent> {
pub state_key: C::StateKey,
}
impl<C: StaticStateEventContent> Serialize for InitialStateEvent<C> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let mut state = serializer.serialize_struct("InitialStateEvent", 3)?;
state.serialize_field("type", &self.content.event_type())?;
state.serialize_field("content", &self.content)?;
state.serialize_field("state_key", &self.state_key)?;
state.end()
}
}
/// A redacted state event.
///
/// `RedactedStateEvent` implements the comparison traits using only the `event_id` field, a sorted