diff --git a/README.md b/README.md index 1ee30dbc..211cabf9 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Ruma 0.6 supports all events and REST endpoints of Matrix v1.0, v1.1 and v1.2. Various changes from in-progress or finished MSCs are also implemented, gated behind the `unstable-mscXXXX` (where `XXXX` is the MSC number) Cargo features. -A few less formalized things are gated behind the `unstable-pre-spec` Cargo +A few less formalized things are gated behind the `unstable-unspecified` Cargo feature. ## Contributing diff --git a/crates/ruma-common/Cargo.toml b/crates/ruma-common/Cargo.toml index 39fd23cb..f112f634 100644 --- a/crates/ruma-common/Cargo.toml +++ b/crates/ruma-common/Cargo.toml @@ -31,9 +31,6 @@ markdown = ["pulldown-cmark"] # https://github.com/dtolnay/trybuild/issues/171 rand = ["dep:rand_crate", "dep:uuid"] unstable-exhaustive-types = [] -unstable-pdu = [] -unstable-pre-spec = [] -unstable-sanitize = ["dep:html5ever", "dep:phf"] unstable-msc1767 = [] unstable-msc2285 = [] unstable-msc2448 = [] @@ -52,6 +49,9 @@ unstable-msc3553 = ["unstable-msc3552"] unstable-msc3554 = ["unstable-msc1767"] unstable-msc3786 = [] unstable-msc3827 = [] +unstable-pdu = [] +unstable-sanitize = ["dep:html5ever", "dep:phf"] +unstable-unspecified = [] [dependencies] base64 = "0.13.0" diff --git a/crates/ruma-common/src/push.rs b/crates/ruma-common/src/push.rs index 4076fb5e..516b56c5 100644 --- a/crates/ruma-common/src/push.rs +++ b/crates/ruma-common/src/push.rs @@ -18,7 +18,7 @@ use std::hash::{Hash, Hasher}; use indexmap::{Equivalent, IndexSet}; use serde::{Deserialize, Serialize}; -#[cfg(feature = "unstable-pre-spec")] +#[cfg(feature = "unstable-unspecified")] use serde_json::Value as JsonValue; use tracing::instrument; @@ -422,7 +422,7 @@ pub struct PusherData { /// /// [sygnal]: https://github.com/matrix-org/sygnal/blob/main/docs/applications.md#ios-applications-beware // Not specified, issue: https://github.com/matrix-org/matrix-spec/issues/921 - #[cfg(feature = "unstable-pre-spec")] + #[cfg(feature = "unstable-unspecified")] #[serde(default, skip_serializing_if = "JsonValue::is_null")] pub default_payload: JsonValue, } @@ -435,12 +435,12 @@ impl PusherData { /// Returns `true` if all fields are `None`. pub fn is_empty(&self) -> bool { - #[cfg(not(feature = "unstable-pre-spec"))] + #[cfg(not(feature = "unstable-unspecified"))] { self.url.is_none() && self.format.is_none() } - #[cfg(feature = "unstable-pre-spec")] + #[cfg(feature = "unstable-unspecified")] { self.url.is_none() && self.format.is_none() && self.default_payload.is_null() } diff --git a/crates/ruma-common/src/thirdparty.rs b/crates/ruma-common/src/thirdparty.rs index 609d3c13..fa0d7cf7 100644 --- a/crates/ruma-common/src/thirdparty.rs +++ b/crates/ruma-common/src/thirdparty.rs @@ -90,7 +90,7 @@ pub struct ProtocolInstance { /// A unique identifier across all instances. /// /// See [matrix-spec#833](https://github.com/matrix-org/matrix-spec/issues/833). - #[cfg(feature = "unstable-pre-spec")] + #[cfg(feature = "unstable-unspecified")] pub instance_id: String, } @@ -113,7 +113,7 @@ pub struct ProtocolInstanceInit { /// A unique identifier across all instances. /// /// See [matrix-spec#833](https://github.com/matrix-org/matrix-spec/issues/833). - #[cfg(feature = "unstable-pre-spec")] + #[cfg(feature = "unstable-unspecified")] pub instance_id: String, } @@ -123,7 +123,7 @@ impl From for ProtocolInstance { desc, fields, network_id, - #[cfg(feature = "unstable-pre-spec")] + #[cfg(feature = "unstable-unspecified")] instance_id, } = init; Self { @@ -131,7 +131,7 @@ impl From for ProtocolInstance { icon: None, fields, network_id, - #[cfg(feature = "unstable-pre-spec")] + #[cfg(feature = "unstable-unspecified")] instance_id, } } diff --git a/crates/ruma-federation-api/Cargo.toml b/crates/ruma-federation-api/Cargo.toml index 196ed3cc..358c9df9 100644 --- a/crates/ruma-federation-api/Cargo.toml +++ b/crates/ruma-federation-api/Cargo.toml @@ -20,10 +20,10 @@ compat = [] client = [] server = [] unstable-exhaustive-types = [] -unstable-pre-spec = [] unstable-msc2448 = [] unstable-msc3618 = [] unstable-msc3723 = [] +unstable-unspecified = [] [dependencies] js_int = { version = "0.2.0", features = ["serde"] } diff --git a/crates/ruma-federation-api/src/membership/create_join_event.rs b/crates/ruma-federation-api/src/membership/create_join_event.rs index 3402847c..814aae75 100644 --- a/crates/ruma-federation-api/src/membership/create_join_event.rs +++ b/crates/ruma-federation-api/src/membership/create_join_event.rs @@ -12,7 +12,7 @@ use serde_json::value::RawValue as RawJsonValue; #[derive(Clone, Debug, Deserialize, Serialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct RoomState { - #[cfg(not(feature = "unstable-pre-spec"))] + #[cfg(not(feature = "unstable-unspecified"))] /// The resident server's DNS name. pub origin: String, @@ -24,7 +24,7 @@ pub struct RoomState { pub state: Vec>, } -#[cfg(feature = "unstable-pre-spec")] +#[cfg(feature = "unstable-unspecified")] impl Default for RoomState { fn default() -> Self { Self::new() @@ -32,19 +32,19 @@ impl Default for RoomState { } impl RoomState { - #[cfg(not(feature = "unstable-pre-spec"))] + #[cfg(not(feature = "unstable-unspecified"))] /// Creates an empty `RoomState` with the given `origin`. /// - /// With the `unstable-pre-spec` feature, this method doesn't take any parameters. + /// With the `unstable-unspecified` feature, this method doesn't take any parameters. /// See [matrix-spec#374](https://github.com/matrix-org/matrix-spec/issues/374). pub fn new(origin: String) -> Self { Self { origin, auth_chain: Vec::new(), state: Vec::new() } } - #[cfg(feature = "unstable-pre-spec")] + #[cfg(feature = "unstable-unspecified")] /// Creates an empty `RoomState` with the given `origin`. /// - /// Without the `unstable-pre-spec` feature, this method takes a parameter for the origin + /// Without the `unstable-unspecified` feature, this method takes a parameter for the origin /// See [matrix-spec#374](https://github.com/matrix-org/matrix-spec/issues/374). pub fn new() -> Self { Self { auth_chain: Vec::new(), state: Vec::new() } diff --git a/crates/ruma-federation-api/src/membership/create_join_event/v1.rs b/crates/ruma-federation-api/src/membership/create_join_event/v1.rs index d1f07007..37333cb3 100644 --- a/crates/ruma-federation-api/src/membership/create_join_event/v1.rs +++ b/crates/ruma-federation-api/src/membership/create_join_event/v1.rs @@ -56,7 +56,7 @@ impl Response { } } -#[cfg(all(test, feature = "server", not(feature = "unstable-pre-spec")))] +#[cfg(all(test, feature = "server", not(feature = "unstable-unspecified")))] mod tests { use ruma_common::api::OutgoingResponse; use serde_json::{from_slice as from_json_slice, json, Value as JsonValue}; diff --git a/crates/ruma-federation-api/src/serde/v1_pdu.rs b/crates/ruma-federation-api/src/serde/v1_pdu.rs index 9f79a3c8..2591a762 100644 --- a/crates/ruma-federation-api/src/serde/v1_pdu.rs +++ b/crates/ruma-federation-api/src/serde/v1_pdu.rs @@ -67,7 +67,7 @@ where } } -#[cfg(not(feature = "unstable-pre-spec"))] +#[cfg(not(feature = "unstable-unspecified"))] #[cfg(test)] mod tests { use assert_matches::assert_matches; diff --git a/crates/ruma-federation-api/src/transactions/send_transaction_message.rs b/crates/ruma-federation-api/src/transactions/send_transaction_message.rs index 46e617be..93c3e79e 100644 --- a/crates/ruma-federation-api/src/transactions/send_transaction_message.rs +++ b/crates/ruma-federation-api/src/transactions/send_transaction_message.rs @@ -44,9 +44,9 @@ pub mod v1 { /// /// Must not be more than 50 items. /// - /// With the `unstable-pre-spec` feature, sending `pdus` is optional. + /// With the `unstable-unspecified` feature, sending `pdus` is optional. /// See [matrix-spec#705](https://github.com/matrix-org/matrix-spec/issues/705). - #[cfg_attr(feature = "unstable-pre-spec", serde(default, skip_serializing_if = "<[_]>::is_empty"))] + #[cfg_attr(feature = "unstable-unspecified", serde(default, skip_serializing_if = "<[_]>::is_empty"))] pub pdus: &'a [Box], /// List of ephemeral messages. diff --git a/crates/ruma-push-gateway-api/Cargo.toml b/crates/ruma-push-gateway-api/Cargo.toml index 40f08fe5..7324d270 100644 --- a/crates/ruma-push-gateway-api/Cargo.toml +++ b/crates/ruma-push-gateway-api/Cargo.toml @@ -15,7 +15,7 @@ all-features = true [features] unstable-exhaustive-types = [] -unstable-pre-spec = [] +unstable-unspecified = [] client = [] server = [] diff --git a/crates/ruma-push-gateway-api/src/send_event_notification.rs b/crates/ruma-push-gateway-api/src/send_event_notification.rs index 9326679d..1a1e463b 100644 --- a/crates/ruma-push-gateway-api/src/send_event_notification.rs +++ b/crates/ruma-push-gateway-api/src/send_event_notification.rs @@ -18,7 +18,7 @@ pub mod v1 { }; use serde::{Deserialize, Serialize}; use serde_json::value::RawValue as RawJsonValue; - #[cfg(feature = "unstable-pre-spec")] + #[cfg(feature = "unstable-unspecified")] use serde_json::value::Value as JsonValue; use crate::PrivOwnedStr; @@ -256,7 +256,7 @@ pub mod v1 { /// /// [sygnal]: https://github.com/matrix-org/sygnal/blob/main/docs/applications.md#ios-applications-beware // Not specified, issue: https://github.com/matrix-org/matrix-spec/issues/921 - #[cfg(feature = "unstable-pre-spec")] + #[cfg(feature = "unstable-unspecified")] #[serde(default, skip_serializing_if = "JsonValue::is_null")] pub default_payload: JsonValue, } @@ -269,12 +269,12 @@ pub mod v1 { /// Returns `true` if all fields are `None`. pub fn is_empty(&self) -> bool { - #[cfg(not(feature = "unstable-pre-spec"))] + #[cfg(not(feature = "unstable-unspecified"))] { self.format.is_none() } - #[cfg(feature = "unstable-pre-spec")] + #[cfg(feature = "unstable-unspecified")] { self.format.is_none() && self.default_payload.is_null() } @@ -285,14 +285,14 @@ pub mod v1 { fn from(data: ruma_common::push::PusherData) -> Self { let ruma_common::push::PusherData { format, - #[cfg(feature = "unstable-pre-spec")] + #[cfg(feature = "unstable-unspecified")] default_payload, .. } = data; Self { format, - #[cfg(feature = "unstable-pre-spec")] + #[cfg(feature = "unstable-unspecified")] default_payload, } } diff --git a/crates/ruma/Cargo.toml b/crates/ruma/Cargo.toml index 82d4e134..bfe4ea97 100644 --- a/crates/ruma/Cargo.toml +++ b/crates/ruma/Cargo.toml @@ -117,13 +117,6 @@ unstable-extensible-events = [ "unstable-msc3488", "unstable-msc3553", ] -unstable-pdu = ["ruma-common/unstable-pdu"] -unstable-pre-spec = [ - "ruma-common/unstable-pre-spec", - "ruma-federation-api?/unstable-pre-spec", - "ruma-push-gateway-api?/unstable-pre-spec", -] -unstable-sanitize = ["ruma-common/unstable-sanitize"] unstable-msc1767 = ["ruma-common/unstable-msc1767"] unstable-msc2246 = ["ruma-client-api?/unstable-msc2246"] unstable-msc2285 = [ @@ -169,11 +162,18 @@ unstable-msc3618 = ["ruma-federation-api?/unstable-msc3618"] unstable-msc3723 = ["ruma-federation-api?/unstable-msc3723"] unstable-msc3786 = ["ruma-common/unstable-msc3786"] unstable-msc3827 = ["ruma-common/unstable-msc3827"] +unstable-pdu = ["ruma-common/unstable-pdu"] +unstable-sanitize = ["ruma-common/unstable-sanitize"] +unstable-unspecified = [ + "ruma-common/unstable-unspecified", + "ruma-federation-api?/unstable-unspecified", + "ruma-push-gateway-api?/unstable-unspecified", +] # Private feature, only used in test / benchmarking code __ci = [ "full", - "unstable-pre-spec", + "unstable-unspecified", "unstable-sanitize", "unstable-msc1767", "unstable-msc2285", diff --git a/crates/ruma/src/lib.rs b/crates/ruma/src/lib.rs index 0be25254..5004821a 100644 --- a/crates/ruma/src/lib.rs +++ b/crates/ruma/src/lib.rs @@ -50,7 +50,8 @@ //! types as exhaustive. //! * `unstable-mscXXXX`, where `XXXX` is the MSC number -- Upcoming Matrix features that may be //! subject to change or removal. -//! * `unstable-pre-spec` -- Undocumented Matrix features that may be subject to change or removal. +//! * `unstable-unspecified` -- Undocumented Matrix features that may be subject to change or +//! removal. //! * `unstable-sanitize` -- Convenience methods for spec-compliant HTML sanitization that have not //! been thoroughly tested. //!