Rename unstable-pre-spec to unstable-unspecified

This commit is contained in:
Jonas Platte 2022-09-20 10:39:20 +02:00
parent 54aa15fc81
commit 1291929131
No known key found for this signature in database
GPG Key ID: AAA7A61F696C3E0C
13 changed files with 40 additions and 39 deletions

View File

@ -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 Various changes from in-progress or finished MSCs are also implemented, gated
behind the `unstable-mscXXXX` (where `XXXX` is the MSC number) Cargo features. 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. feature.
## Contributing ## Contributing

View File

@ -31,9 +31,6 @@ markdown = ["pulldown-cmark"]
# https://github.com/dtolnay/trybuild/issues/171 # https://github.com/dtolnay/trybuild/issues/171
rand = ["dep:rand_crate", "dep:uuid"] rand = ["dep:rand_crate", "dep:uuid"]
unstable-exhaustive-types = [] unstable-exhaustive-types = []
unstable-pdu = []
unstable-pre-spec = []
unstable-sanitize = ["dep:html5ever", "dep:phf"]
unstable-msc1767 = [] unstable-msc1767 = []
unstable-msc2285 = [] unstable-msc2285 = []
unstable-msc2448 = [] unstable-msc2448 = []
@ -52,6 +49,9 @@ unstable-msc3553 = ["unstable-msc3552"]
unstable-msc3554 = ["unstable-msc1767"] unstable-msc3554 = ["unstable-msc1767"]
unstable-msc3786 = [] unstable-msc3786 = []
unstable-msc3827 = [] unstable-msc3827 = []
unstable-pdu = []
unstable-sanitize = ["dep:html5ever", "dep:phf"]
unstable-unspecified = []
[dependencies] [dependencies]
base64 = "0.13.0" base64 = "0.13.0"

View File

@ -18,7 +18,7 @@ use std::hash::{Hash, Hasher};
use indexmap::{Equivalent, IndexSet}; use indexmap::{Equivalent, IndexSet};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-unspecified")]
use serde_json::Value as JsonValue; use serde_json::Value as JsonValue;
use tracing::instrument; 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 /// [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 // 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")] #[serde(default, skip_serializing_if = "JsonValue::is_null")]
pub default_payload: JsonValue, pub default_payload: JsonValue,
} }
@ -435,12 +435,12 @@ impl PusherData {
/// Returns `true` if all fields are `None`. /// Returns `true` if all fields are `None`.
pub fn is_empty(&self) -> bool { 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() 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() self.url.is_none() && self.format.is_none() && self.default_payload.is_null()
} }

View File

@ -90,7 +90,7 @@ pub struct ProtocolInstance {
/// A unique identifier across all instances. /// A unique identifier across all instances.
/// ///
/// See [matrix-spec#833](https://github.com/matrix-org/matrix-spec/issues/833). /// 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, pub instance_id: String,
} }
@ -113,7 +113,7 @@ pub struct ProtocolInstanceInit {
/// A unique identifier across all instances. /// A unique identifier across all instances.
/// ///
/// See [matrix-spec#833](https://github.com/matrix-org/matrix-spec/issues/833). /// 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, pub instance_id: String,
} }
@ -123,7 +123,7 @@ impl From<ProtocolInstanceInit> for ProtocolInstance {
desc, desc,
fields, fields,
network_id, network_id,
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-unspecified")]
instance_id, instance_id,
} = init; } = init;
Self { Self {
@ -131,7 +131,7 @@ impl From<ProtocolInstanceInit> for ProtocolInstance {
icon: None, icon: None,
fields, fields,
network_id, network_id,
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-unspecified")]
instance_id, instance_id,
} }
} }

View File

@ -20,10 +20,10 @@ compat = []
client = [] client = []
server = [] server = []
unstable-exhaustive-types = [] unstable-exhaustive-types = []
unstable-pre-spec = []
unstable-msc2448 = [] unstable-msc2448 = []
unstable-msc3618 = [] unstable-msc3618 = []
unstable-msc3723 = [] unstable-msc3723 = []
unstable-unspecified = []
[dependencies] [dependencies]
js_int = { version = "0.2.0", features = ["serde"] } js_int = { version = "0.2.0", features = ["serde"] }

View File

@ -12,7 +12,7 @@ use serde_json::value::RawValue as RawJsonValue;
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct RoomState { pub struct RoomState {
#[cfg(not(feature = "unstable-pre-spec"))] #[cfg(not(feature = "unstable-unspecified"))]
/// The resident server's DNS name. /// The resident server's DNS name.
pub origin: String, pub origin: String,
@ -24,7 +24,7 @@ pub struct RoomState {
pub state: Vec<Box<RawJsonValue>>, pub state: Vec<Box<RawJsonValue>>,
} }
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-unspecified")]
impl Default for RoomState { impl Default for RoomState {
fn default() -> Self { fn default() -> Self {
Self::new() Self::new()
@ -32,19 +32,19 @@ impl Default for RoomState {
} }
impl RoomState { impl RoomState {
#[cfg(not(feature = "unstable-pre-spec"))] #[cfg(not(feature = "unstable-unspecified"))]
/// Creates an empty `RoomState` with the given `origin`. /// 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). /// See [matrix-spec#374](https://github.com/matrix-org/matrix-spec/issues/374).
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")] #[cfg(feature = "unstable-unspecified")]
/// Creates an empty `RoomState` with the given `origin`. /// 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). /// See [matrix-spec#374](https://github.com/matrix-org/matrix-spec/issues/374).
pub fn new() -> Self { pub fn new() -> Self {
Self { auth_chain: Vec::new(), state: Vec::new() } Self { auth_chain: Vec::new(), state: Vec::new() }

View File

@ -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 { mod tests {
use ruma_common::api::OutgoingResponse; use ruma_common::api::OutgoingResponse;
use serde_json::{from_slice as from_json_slice, json, Value as JsonValue}; use serde_json::{from_slice as from_json_slice, json, Value as JsonValue};

View File

@ -67,7 +67,7 @@ where
} }
} }
#[cfg(not(feature = "unstable-pre-spec"))] #[cfg(not(feature = "unstable-unspecified"))]
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use assert_matches::assert_matches; use assert_matches::assert_matches;

View File

@ -44,9 +44,9 @@ pub mod v1 {
/// ///
/// Must not be more than 50 items. /// 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). /// 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<RawJsonValue>], pub pdus: &'a [Box<RawJsonValue>],
/// List of ephemeral messages. /// List of ephemeral messages.

View File

@ -15,7 +15,7 @@ all-features = true
[features] [features]
unstable-exhaustive-types = [] unstable-exhaustive-types = []
unstable-pre-spec = [] unstable-unspecified = []
client = [] client = []
server = [] server = []

View File

@ -18,7 +18,7 @@ pub mod v1 {
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::value::RawValue as RawJsonValue; use serde_json::value::RawValue as RawJsonValue;
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-unspecified")]
use serde_json::value::Value as JsonValue; use serde_json::value::Value as JsonValue;
use crate::PrivOwnedStr; 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 /// [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 // 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")] #[serde(default, skip_serializing_if = "JsonValue::is_null")]
pub default_payload: JsonValue, pub default_payload: JsonValue,
} }
@ -269,12 +269,12 @@ pub mod v1 {
/// Returns `true` if all fields are `None`. /// Returns `true` if all fields are `None`.
pub fn is_empty(&self) -> bool { pub fn is_empty(&self) -> bool {
#[cfg(not(feature = "unstable-pre-spec"))] #[cfg(not(feature = "unstable-unspecified"))]
{ {
self.format.is_none() self.format.is_none()
} }
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-unspecified")]
{ {
self.format.is_none() && self.default_payload.is_null() self.format.is_none() && self.default_payload.is_null()
} }
@ -285,14 +285,14 @@ pub mod v1 {
fn from(data: ruma_common::push::PusherData) -> Self { fn from(data: ruma_common::push::PusherData) -> Self {
let ruma_common::push::PusherData { let ruma_common::push::PusherData {
format, format,
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-unspecified")]
default_payload, default_payload,
.. ..
} = data; } = data;
Self { Self {
format, format,
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-unspecified")]
default_payload, default_payload,
} }
} }

View File

@ -117,13 +117,6 @@ unstable-extensible-events = [
"unstable-msc3488", "unstable-msc3488",
"unstable-msc3553", "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-msc1767 = ["ruma-common/unstable-msc1767"]
unstable-msc2246 = ["ruma-client-api?/unstable-msc2246"] unstable-msc2246 = ["ruma-client-api?/unstable-msc2246"]
unstable-msc2285 = [ unstable-msc2285 = [
@ -169,11 +162,18 @@ unstable-msc3618 = ["ruma-federation-api?/unstable-msc3618"]
unstable-msc3723 = ["ruma-federation-api?/unstable-msc3723"] unstable-msc3723 = ["ruma-federation-api?/unstable-msc3723"]
unstable-msc3786 = ["ruma-common/unstable-msc3786"] unstable-msc3786 = ["ruma-common/unstable-msc3786"]
unstable-msc3827 = ["ruma-common/unstable-msc3827"] 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 # Private feature, only used in test / benchmarking code
__ci = [ __ci = [
"full", "full",
"unstable-pre-spec", "unstable-unspecified",
"unstable-sanitize", "unstable-sanitize",
"unstable-msc1767", "unstable-msc1767",
"unstable-msc2285", "unstable-msc2285",

View File

@ -50,7 +50,8 @@
//! types as exhaustive. //! types as exhaustive.
//! * `unstable-mscXXXX`, where `XXXX` is the MSC number -- Upcoming Matrix features that may be //! * `unstable-mscXXXX`, where `XXXX` is the MSC number -- Upcoming Matrix features that may be
//! subject to change or removal. //! 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 //! * `unstable-sanitize` -- Convenience methods for spec-compliant HTML sanitization that have not
//! been thoroughly tested. //! been thoroughly tested.
//! //!