From c04a9e71c521b0969b9168e8ed95a8c35655e8b2 Mon Sep 17 00:00:00 2001 From: Devin Ragotzy Date: Wed, 28 Oct 2020 06:54:01 -0700 Subject: [PATCH] Add the unstable-pre-spec feature to the federation-api crate --- ruma-federation-api/Cargo.toml | 1 + .../src/membership/create_join_event.rs | 14 ++++++++++++++ ruma/Cargo.toml | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ruma-federation-api/Cargo.toml b/ruma-federation-api/Cargo.toml index 28ed7050..901d9299 100644 --- a/ruma-federation-api/Cargo.toml +++ b/ruma-federation-api/Cargo.toml @@ -30,3 +30,4 @@ matches = "0.1.8" [features] unstable-exhaustive-types = [] +unstable-pre-spec = [] diff --git a/ruma-federation-api/src/membership/create_join_event.rs b/ruma-federation-api/src/membership/create_join_event.rs index 04809bfa..8bf1e562 100644 --- a/ruma-federation-api/src/membership/create_join_event.rs +++ b/ruma-federation-api/src/membership/create_join_event.rs @@ -23,9 +23,23 @@ pub struct RoomState { pub state: Vec>, } +#[cfg(feature = "unstable-pre-spec")] +impl Default for RoomState { + fn default() -> Self { + Self::new() + } +} + impl RoomState { + #[cfg(not(feature = "unstable-pre-spec"))] /// Creates an empty `RoomState` with the given `origin`. pub fn new(origin: String) -> Self { Self { origin, auth_chain: Vec::new(), state: Vec::new() } } + + #[cfg(feature = "unstable-pre-spec")] + /// Creates an empty `RoomState` with the given `origin`. + pub fn new() -> Self { + Self { auth_chain: Vec::new(), state: Vec::new() } + } } diff --git a/ruma/Cargo.toml b/ruma/Cargo.toml index cb4fd15e..6fbfd68e 100644 --- a/ruma/Cargo.toml +++ b/ruma/Cargo.toml @@ -22,7 +22,7 @@ unstable-exhaustive-types = [ "ruma-federation-api/unstable-exhaustive-types", "ruma-common/unstable-exhaustive-types", ] -unstable-pre-spec = ["ruma-client-api/unstable-pre-spec", "ruma-events/unstable-pre-spec"] +unstable-pre-spec = ["ruma-client-api/unstable-pre-spec", "ruma-events/unstable-pre-spec", "ruma-federation-api/unstable-pre-spec"] unstable-synapse-quirks = [ "ruma-client-api/unstable-synapse-quirks", "ruma-common/unstable-synapse-quirks",