Add unstable-exhaustive-types flag to ruma-common
This commit is contained in:
parent
19af16850c
commit
a3ae741699
@ -21,3 +21,6 @@ strum = { version = "0.19.2", features = ["derive"] }
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
matches = "0.1.8"
|
matches = "0.1.8"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
unstable-exhaustive-types = []
|
||||||
|
@ -18,7 +18,7 @@ use serde_json::Value as JsonValue;
|
|||||||
/// To create an instance of this type, first create a `PublicRoomsChunkInit` and convert it via
|
/// To create an instance of this type, first create a `PublicRoomsChunkInit` and convert it via
|
||||||
/// `PublicRoomsChunk::from` / `.into()`.
|
/// `PublicRoomsChunk::from` / `.into()`.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct PublicRoomsChunk {
|
pub struct PublicRoomsChunk {
|
||||||
/// Aliases of the room.
|
/// Aliases of the room.
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
@ -97,7 +97,7 @@ impl From<PublicRoomsChunkInit> for PublicRoomsChunk {
|
|||||||
|
|
||||||
/// A filter for public rooms lists
|
/// A filter for public rooms lists
|
||||||
#[derive(Clone, Debug, Default, Outgoing, Serialize)]
|
#[derive(Clone, Debug, Default, Outgoing, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct Filter<'a> {
|
pub struct Filter<'a> {
|
||||||
/// A string to search for in the room metadata, e.g. name, topic, canonical alias etc.
|
/// A string to search for in the room metadata, e.g. name, topic, canonical alias etc.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
@ -114,7 +114,7 @@ impl Filter<'_> {
|
|||||||
/// Information about which networks/protocols from application services on the
|
/// Information about which networks/protocols from application services on the
|
||||||
/// homeserver from which to request rooms.
|
/// homeserver from which to request rooms.
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Outgoing)]
|
#[derive(Clone, Debug, PartialEq, Eq, Outgoing)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
#[incoming_derive(Clone, PartialEq, Eq, !Deserialize)]
|
#[incoming_derive(Clone, PartialEq, Eq, !Deserialize)]
|
||||||
pub enum RoomNetwork<'a> {
|
pub enum RoomNetwork<'a> {
|
||||||
/// Return rooms from the Matrix network.
|
/// Return rooms from the Matrix network.
|
||||||
|
@ -11,7 +11,7 @@ use serde::Serialize;
|
|||||||
|
|
||||||
/// Identity keys for a device.
|
/// Identity keys for a device.
|
||||||
#[derive(Clone, Debug, Outgoing, Serialize)]
|
#[derive(Clone, Debug, Outgoing, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
#[incoming_derive(Clone, Serialize)]
|
#[incoming_derive(Clone, Serialize)]
|
||||||
pub struct DeviceKeys<'a> {
|
pub struct DeviceKeys<'a> {
|
||||||
/// The ID of the user the device belongs to. Must match the user ID used when logging in.
|
/// The ID of the user the device belongs to. Must match the user ID used when logging in.
|
||||||
@ -51,7 +51,7 @@ impl<'a> DeviceKeys<'a> {
|
|||||||
|
|
||||||
/// Additional data added to device key information by intermediate servers.
|
/// Additional data added to device key information by intermediate servers.
|
||||||
#[derive(Clone, Debug, Default, Outgoing, Serialize)]
|
#[derive(Clone, Debug, Default, Outgoing, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
#[incoming_derive(Clone, Serialize)]
|
#[incoming_derive(Clone, Serialize)]
|
||||||
pub struct UnsignedDeviceInfo<'a> {
|
pub struct UnsignedDeviceInfo<'a> {
|
||||||
/// The display name which the user set on the device.
|
/// The display name which the user set on the device.
|
||||||
|
@ -7,7 +7,7 @@ use strum::{Display, EnumString};
|
|||||||
|
|
||||||
/// A description of a user's connectivity and availability for chat.
|
/// A description of a user's connectivity and availability for chat.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Deserialize, Serialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Deserialize, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
pub enum PresenceState {
|
pub enum PresenceState {
|
||||||
|
@ -19,7 +19,7 @@ pub use self::{
|
|||||||
/// For example, some rules may only be applied for messages from a particular sender, a particular
|
/// For example, some rules may only be applied for messages from a particular sender, a particular
|
||||||
/// room, or by default. The push ruleset contains the entire set of scopes and rules.
|
/// room, or by default. The push ruleset contains the entire set of scopes and rules.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct Ruleset {
|
pub struct Ruleset {
|
||||||
/// These rules configure behavior for (unencrypted) messages that match certain patterns.
|
/// These rules configure behavior for (unencrypted) messages that match certain patterns.
|
||||||
pub content: Vec<PatternedPushRule>,
|
pub content: Vec<PatternedPushRule>,
|
||||||
@ -58,7 +58,7 @@ impl Ruleset {
|
|||||||
/// To create an instance of this type, first create a `PushRuleInit` and convert it via
|
/// To create an instance of this type, first create a `PushRuleInit` and convert it via
|
||||||
/// `PushRule::from` / `.into()`.
|
/// `PushRule::from` / `.into()`.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct PushRule {
|
pub struct PushRule {
|
||||||
/// Actions to determine if and how a notification is delivered for events matching this rule.
|
/// Actions to determine if and how a notification is delivered for events matching this rule.
|
||||||
pub actions: Vec<Action>,
|
pub actions: Vec<Action>,
|
||||||
@ -106,7 +106,7 @@ impl From<PushRuleInit> for PushRule {
|
|||||||
/// To create an instance of this type, first create a `ConditionalPushRuleInit` and convert it via
|
/// To create an instance of this type, first create a `ConditionalPushRuleInit` and convert it via
|
||||||
/// `ConditionalPushRule::from` / `.into()`.
|
/// `ConditionalPushRule::from` / `.into()`.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct ConditionalPushRule {
|
pub struct ConditionalPushRule {
|
||||||
/// Actions to determine if and how a notification is delivered for events matching this rule.
|
/// Actions to determine if and how a notification is delivered for events matching this rule.
|
||||||
pub actions: Vec<Action>,
|
pub actions: Vec<Action>,
|
||||||
@ -166,7 +166,7 @@ impl From<ConditionalPushRuleInit> for ConditionalPushRule {
|
|||||||
/// To create an instance of this type, first create a `PatternedPushRuleInit` and convert it via
|
/// To create an instance of this type, first create a `PatternedPushRuleInit` and convert it via
|
||||||
/// `PatternedPushRule::from` / `.into()`.
|
/// `PatternedPushRule::from` / `.into()`.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct PatternedPushRule {
|
pub struct PatternedPushRule {
|
||||||
/// Actions to determine if and how a notification is delivered for events matching this rule.
|
/// Actions to determine if and how a notification is delivered for events matching this rule.
|
||||||
pub actions: Vec<Action>,
|
pub actions: Vec<Action>,
|
||||||
|
@ -8,7 +8,7 @@ use serde_json::value::RawValue as RawJsonValue;
|
|||||||
///
|
///
|
||||||
/// See https://matrix.org/docs/spec/client_server/r0.6.0#actions for details.
|
/// See https://matrix.org/docs/spec/client_server/r0.6.0#actions for details.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub enum Action {
|
pub enum Action {
|
||||||
/// Causes matching events to generate a notification.
|
/// Causes matching events to generate a notification.
|
||||||
Notify,
|
Notify,
|
||||||
@ -26,7 +26,7 @@ pub enum Action {
|
|||||||
|
|
||||||
/// The `set_tweak` action.
|
/// The `set_tweak` action.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
#[serde(from = "tweak_serde::Tweak", into = "tweak_serde::Tweak")]
|
#[serde(from = "tweak_serde::Tweak", into = "tweak_serde::Tweak")]
|
||||||
pub enum Tweak {
|
pub enum Tweak {
|
||||||
/// A string representing the sound to be played when this notification arrives.
|
/// A string representing the sound to be played when this notification arrives.
|
||||||
|
@ -16,7 +16,7 @@ use super::{
|
|||||||
///
|
///
|
||||||
/// To create an instance of this type, use one of its `From` implementations.
|
/// To create an instance of this type, use one of its `From` implementations.
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct AnyPushRule {
|
pub struct AnyPushRule {
|
||||||
/// The actions to perform when this rule is matched.
|
/// The actions to perform when this rule is matched.
|
||||||
pub actions: Vec<Action>,
|
pub actions: Vec<Action>,
|
||||||
@ -94,7 +94,7 @@ impl From<AnyPushRule> for PushRule {
|
|||||||
/// An error that happens when `AnyPushRule` cannot
|
/// An error that happens when `AnyPushRule` cannot
|
||||||
/// be converted into `PatternedPushRule`
|
/// be converted into `PatternedPushRule`
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct MissingPatternError;
|
pub struct MissingPatternError;
|
||||||
|
|
||||||
impl Display for MissingPatternError {
|
impl Display for MissingPatternError {
|
||||||
@ -122,7 +122,7 @@ impl TryFrom<AnyPushRule> for PatternedPushRule {
|
|||||||
/// An error that happens when `AnyPushRule` cannot
|
/// An error that happens when `AnyPushRule` cannot
|
||||||
/// be converted into `ConditionalPushRule`
|
/// be converted into `ConditionalPushRule`
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct MissingConditionsError;
|
pub struct MissingConditionsError;
|
||||||
|
|
||||||
impl Display for MissingConditionsError {
|
impl Display for MissingConditionsError {
|
||||||
|
@ -6,7 +6,7 @@ pub use room_member_count_is::{ComparisonOperator, RoomMemberCountIs};
|
|||||||
|
|
||||||
/// A condition that must apply for an associated push rule's action to be taken.
|
/// A condition that must apply for an associated push rule's action to be taken.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
#[serde(tag = "kind", rename_all = "snake_case")]
|
#[serde(tag = "kind", rename_all = "snake_case")]
|
||||||
pub enum PushCondition {
|
pub enum PushCondition {
|
||||||
/// This is a glob pattern match on a field of the event.
|
/// This is a glob pattern match on a field of the event.
|
||||||
|
@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
/// To create an instance of this type, first create a `ProtocolInit` and convert it via
|
/// To create an instance of this type, first create a `ProtocolInit` and convert it via
|
||||||
/// `Protocol::from` / `.into()`.
|
/// `Protocol::from` / `.into()`.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct Protocol {
|
pub struct Protocol {
|
||||||
/// Fields which may be used to identify a third party user.
|
/// Fields which may be used to identify a third party user.
|
||||||
pub user_fields: Vec<String>,
|
pub user_fields: Vec<String>,
|
||||||
@ -65,7 +65,7 @@ impl From<ProtocolInit> for Protocol {
|
|||||||
/// To create an instance of this type, first create a `ProtocolInstanceInit` and convert it via
|
/// To create an instance of this type, first create a `ProtocolInstanceInit` and convert it via
|
||||||
/// `ProtocolInstance::from` / `.into()`.
|
/// `ProtocolInstance::from` / `.into()`.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct ProtocolInstance {
|
pub struct ProtocolInstance {
|
||||||
/// A human-readable description for the protocol, such as the name.
|
/// A human-readable description for the protocol, such as the name.
|
||||||
pub desc: String,
|
pub desc: String,
|
||||||
@ -109,7 +109,7 @@ impl From<ProtocolInstanceInit> for ProtocolInstance {
|
|||||||
/// To create an instance of this type, first create a `FieldTypeInit` and convert it via
|
/// To create an instance of this type, first create a `FieldTypeInit` and convert it via
|
||||||
/// `FieldType::from` / `.into()`.
|
/// `FieldType::from` / `.into()`.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct FieldType {
|
pub struct FieldType {
|
||||||
/// A regular expression for validation of a field's value.
|
/// A regular expression for validation of a field's value.
|
||||||
pub regexp: String,
|
pub regexp: String,
|
||||||
@ -140,7 +140,7 @@ impl From<FieldTypeInit> for FieldType {
|
|||||||
|
|
||||||
/// A third party network location.
|
/// A third party network location.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct Location {
|
pub struct Location {
|
||||||
/// An alias for a matrix room.
|
/// An alias for a matrix room.
|
||||||
pub alias: RoomAliasId,
|
pub alias: RoomAliasId,
|
||||||
@ -181,7 +181,7 @@ impl User {
|
|||||||
|
|
||||||
/// The medium of a third party identifier.
|
/// The medium of a third party identifier.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize)]
|
||||||
#[non_exhaustive]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
pub enum Medium {
|
pub enum Medium {
|
||||||
/// Email address identifier
|
/// Email address identifier
|
||||||
|
@ -20,6 +20,7 @@ unstable-exhaustive-types = [
|
|||||||
"ruma-appservice-api/unstable-exhaustive-types",
|
"ruma-appservice-api/unstable-exhaustive-types",
|
||||||
"ruma-client-api/unstable-exhaustive-types",
|
"ruma-client-api/unstable-exhaustive-types",
|
||||||
"ruma-federation-api/unstable-exhaustive-types",
|
"ruma-federation-api/unstable-exhaustive-types",
|
||||||
|
"ruma-common/unstable-exhaustive-types",
|
||||||
]
|
]
|
||||||
unstable-pre-spec = ["ruma-client-api/unstable-pre-spec"]
|
unstable-pre-spec = ["ruma-client-api/unstable-pre-spec"]
|
||||||
unstable-synapse-quirks = ["ruma-client-api/unstable-synapse-quirks"]
|
unstable-synapse-quirks = ["ruma-client-api/unstable-synapse-quirks"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user