events: Implement Default for InitialStateEvent

… where C has an empty state key and implements Default itself.
This commit is contained in:
Jonas Platte 2023-03-10 11:51:49 +01:00 committed by Jonas Platte
parent d56386a636
commit 4049969d8c

View File

@ -349,6 +349,15 @@ impl<C: StaticStateEventContent> InitialStateEvent<C> {
} }
} }
impl<C> Default for InitialStateEvent<C>
where
C: StaticStateEventContent<StateKey = EmptyStateKey> + Default,
{
fn default() -> Self {
Self { content: Default::default(), state_key: EmptyStateKey }
}
}
impl<C: StaticStateEventContent> Serialize for InitialStateEvent<C> { impl<C: StaticStateEventContent> Serialize for InitialStateEvent<C> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where