Add the unstable-pre-spec feature to the federation-api crate

This commit is contained in:
Devin Ragotzy 2020-10-28 06:54:01 -07:00 committed by GitHub
parent 3f7c6f6bea
commit c04a9e71c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -30,3 +30,4 @@ matches = "0.1.8"
[features] [features]
unstable-exhaustive-types = [] unstable-exhaustive-types = []
unstable-pre-spec = []

View File

@ -23,9 +23,23 @@ pub struct RoomState {
pub state: Vec<Raw<Pdu>>, pub state: Vec<Raw<Pdu>>,
} }
#[cfg(feature = "unstable-pre-spec")]
impl Default for RoomState {
fn default() -> Self {
Self::new()
}
}
impl RoomState { impl RoomState {
#[cfg(not(feature = "unstable-pre-spec"))]
/// Creates an empty `RoomState` with the given `origin`. /// Creates an empty `RoomState` with the given `origin`.
pub fn new(origin: String) -> Self { pub fn new(origin: String) -> Self {
Self { origin, auth_chain: Vec::new(), state: Vec::new() } 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() }
}
} }

View File

@ -22,7 +22,7 @@ unstable-exhaustive-types = [
"ruma-federation-api/unstable-exhaustive-types", "ruma-federation-api/unstable-exhaustive-types",
"ruma-common/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 = [ unstable-synapse-quirks = [
"ruma-client-api/unstable-synapse-quirks", "ruma-client-api/unstable-synapse-quirks",
"ruma-common/unstable-synapse-quirks", "ruma-common/unstable-synapse-quirks",