From 4049969d8c6e396fc7eb5ce6569b89d90eba0645 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 10 Mar 2023 11:51:49 +0100 Subject: [PATCH] events: Implement Default for InitialStateEvent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … where C has an empty state key and implements Default itself. --- crates/ruma-common/src/events/kinds.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/ruma-common/src/events/kinds.rs b/crates/ruma-common/src/events/kinds.rs index 9e7dd198..524599fa 100644 --- a/crates/ruma-common/src/events/kinds.rs +++ b/crates/ruma-common/src/events/kinds.rs @@ -349,6 +349,15 @@ impl InitialStateEvent { } } +impl Default for InitialStateEvent +where + C: StaticStateEventContent + Default, +{ + fn default() -> Self { + Self { content: Default::default(), state_key: EmptyStateKey } + } +} + impl Serialize for InitialStateEvent { fn serialize(&self, serializer: S) -> Result where