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
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

View File

@ -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"

View File

@ -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()
}

View File

@ -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<ProtocolInstanceInit> 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<ProtocolInstanceInit> for ProtocolInstance {
icon: None,
fields,
network_id,
#[cfg(feature = "unstable-pre-spec")]
#[cfg(feature = "unstable-unspecified")]
instance_id,
}
}

View File

@ -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"] }

View File

@ -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<Box<RawJsonValue>>,
}
#[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() }

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 {
use ruma_common::api::OutgoingResponse;
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)]
mod tests {
use assert_matches::assert_matches;

View File

@ -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<RawJsonValue>],
/// List of ephemeral messages.

View File

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

View File

@ -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,
}
}

View File

@ -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",

View File

@ -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.
//!