Bump MSRV to 1.40.0
This commit is contained in:
parent
14ba542ba1
commit
17faaaa56e
@ -6,8 +6,8 @@ sources:
|
|||||||
tasks:
|
tasks:
|
||||||
- rustup: |
|
- rustup: |
|
||||||
# We specify --profile minimal because we'd otherwise download docs
|
# We specify --profile minimal because we'd otherwise download docs
|
||||||
rustup toolchain install 1.38.0 --profile minimal
|
rustup toolchain install 1.40.0 --profile minimal
|
||||||
rustup default 1.38.0
|
rustup default 1.40.0
|
||||||
- test: |
|
- test: |
|
||||||
cd ruma-events
|
cd ruma-events
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
## Minimum Rust version
|
## Minimum Rust version
|
||||||
|
|
||||||
ruma-events requires Rust 1.38.0 or later.
|
ruma-events requires Rust 1.40.0 or later.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
/// An encryption algorithm to be used to encrypt messages sent to a room.
|
/// An encryption algorithm to be used to encrypt messages sent to a room.
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
#[non_exhaustive]
|
||||||
#[serde(from = "String", into = "String")]
|
#[serde(from = "String", into = "String")]
|
||||||
pub enum Algorithm {
|
pub enum Algorithm {
|
||||||
/// Olm version 1 using Curve25519, AES-256, and SHA-256.
|
/// Olm version 1 using Curve25519, AES-256, and SHA-256.
|
||||||
@ -14,11 +15,6 @@ pub enum Algorithm {
|
|||||||
|
|
||||||
/// Any algorithm that is not part of the specification.
|
/// Any algorithm that is not part of the specification.
|
||||||
Custom(String),
|
Custom(String),
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to `ruma-events`.
|
|
||||||
#[doc(hidden)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Algorithm {
|
impl Display for Algorithm {
|
||||||
@ -27,9 +23,6 @@ impl Display for Algorithm {
|
|||||||
Algorithm::OlmV1Curve25519AesSha2 => "m.olm.v1.curve25519-aes-sha2",
|
Algorithm::OlmV1Curve25519AesSha2 => "m.olm.v1.curve25519-aes-sha2",
|
||||||
Algorithm::MegolmV1AesSha2 => "m.megolm.v1.aes-sha2",
|
Algorithm::MegolmV1AesSha2 => "m.megolm.v1.aes-sha2",
|
||||||
Algorithm::Custom(ref algorithm) => algorithm,
|
Algorithm::Custom(ref algorithm) => algorithm,
|
||||||
Algorithm::__Nonexhaustive => {
|
|
||||||
panic!("__Nonexhaustive enum variant is not intended for use.")
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
write!(f, "{}", algorithm_str)
|
write!(f, "{}", algorithm_str)
|
||||||
|
@ -22,6 +22,7 @@ pub struct SessionDescription {
|
|||||||
|
|
||||||
/// The type of VoIP session description.
|
/// The type of VoIP session description.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
|
||||||
|
#[non_exhaustive]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
pub enum SessionDescriptionType {
|
pub enum SessionDescriptionType {
|
||||||
/// An answer.
|
/// An answer.
|
||||||
@ -29,12 +30,6 @@ pub enum SessionDescriptionType {
|
|||||||
|
|
||||||
/// An offer.
|
/// An offer.
|
||||||
Offer,
|
Offer,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_enum! {
|
impl_enum! {
|
||||||
|
@ -37,12 +37,6 @@ pub enum Reason {
|
|||||||
|
|
||||||
/// Party did not answer in time.
|
/// Party did not answer in time.
|
||||||
InviteTimeout,
|
InviteTimeout,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_enum! {
|
impl_enum! {
|
||||||
|
@ -405,9 +405,6 @@ impl<'de> Deserialize<'de> for Event {
|
|||||||
from_value(value, Event::Custom)
|
from_value(value, Event::Custom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__Nonexhaustive => {
|
|
||||||
unreachable!("__Nonexhaustive variant should be impossible to obtain.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -474,9 +471,6 @@ impl<'de> Deserialize<'de> for RoomEvent {
|
|||||||
| RoomKeyRequest
|
| RoomKeyRequest
|
||||||
| Tag
|
| Tag
|
||||||
| Typing => Err(D::Error::custom("invalid event type")),
|
| Typing => Err(D::Error::custom("invalid event type")),
|
||||||
__Nonexhaustive => {
|
|
||||||
unreachable!("__Nonexhaustive variant should be impossible to obtain.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -537,9 +531,6 @@ impl<'de> Deserialize<'de> for StateEvent {
|
|||||||
| Sticker
|
| Sticker
|
||||||
| Tag
|
| Tag
|
||||||
| Typing => Err(D::Error::custom("invalid event type")),
|
| Typing => Err(D::Error::custom("invalid event type")),
|
||||||
__Nonexhaustive => {
|
|
||||||
unreachable!("__Nonexhaustive variant should be impossible to obtain.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,9 +190,6 @@ impl<'de> Deserialize<'de> for Event {
|
|||||||
| RoomTopic
|
| RoomTopic
|
||||||
| RoomRedaction
|
| RoomRedaction
|
||||||
| Sticker => Err(D::Error::custom("invalid event type")),
|
| Sticker => Err(D::Error::custom("invalid event type")),
|
||||||
__Nonexhaustive => {
|
|
||||||
unreachable!("__Nonexhaustive variant should be impossible to obtain.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,9 +250,6 @@ impl<'de> Deserialize<'de> for RoomEvent {
|
|||||||
| RoomTopic
|
| RoomTopic
|
||||||
| Tag
|
| Tag
|
||||||
| Typing => Err(D::Error::custom("invalid event type")),
|
| Typing => Err(D::Error::custom("invalid event type")),
|
||||||
__Nonexhaustive => {
|
|
||||||
unreachable!("__Nonexhaustive variant should be impossible to obtain.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
/// The type of an event.
|
/// The type of an event.
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||||
|
#[non_exhaustive]
|
||||||
#[serde(from = "String", into = "String")]
|
#[serde(from = "String", into = "String")]
|
||||||
pub enum EventType {
|
pub enum EventType {
|
||||||
/// m.call.answer
|
/// m.call.answer
|
||||||
@ -137,11 +138,6 @@ pub enum EventType {
|
|||||||
|
|
||||||
/// Any event that is not part of the specification.
|
/// Any event that is not part of the specification.
|
||||||
Custom(String),
|
Custom(String),
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for EventType {
|
impl Display for EventType {
|
||||||
@ -191,9 +187,6 @@ impl Display for EventType {
|
|||||||
EventType::Tag => "m.tag",
|
EventType::Tag => "m.tag",
|
||||||
EventType::Typing => "m.typing",
|
EventType::Typing => "m.typing",
|
||||||
EventType::Custom(ref event_type) => event_type,
|
EventType::Custom(ref event_type) => event_type,
|
||||||
EventType::__Nonexhaustive => {
|
|
||||||
panic!("__Nonexhaustive enum variant is not intended for use.")
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
write!(f, "{}", event_type_str)
|
write!(f, "{}", event_type_str)
|
||||||
|
@ -17,12 +17,6 @@ pub enum HashAlgorithm {
|
|||||||
/// The SHA256 hash algorithm.
|
/// The SHA256 hash algorithm.
|
||||||
#[serde(rename = "sha256")]
|
#[serde(rename = "sha256")]
|
||||||
Sha256,
|
Sha256,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_enum! {
|
impl_enum! {
|
||||||
@ -37,12 +31,6 @@ pub enum KeyAgreementProtocol {
|
|||||||
/// The [Curve25519](https://cr.yp.to/ecdh.html) key agreement protocol.
|
/// The [Curve25519](https://cr.yp.to/ecdh.html) key agreement protocol.
|
||||||
#[serde(rename = "curve25519")]
|
#[serde(rename = "curve25519")]
|
||||||
Curve25519,
|
Curve25519,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_enum! {
|
impl_enum! {
|
||||||
@ -57,12 +45,6 @@ pub enum MessageAuthenticationCode {
|
|||||||
/// The HKDF-HMAC-SHA256 MAC.
|
/// The HKDF-HMAC-SHA256 MAC.
|
||||||
#[serde(rename = "hkdf-hmac-sha256")]
|
#[serde(rename = "hkdf-hmac-sha256")]
|
||||||
HkdfHmacSha256,
|
HkdfHmacSha256,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_enum! {
|
impl_enum! {
|
||||||
@ -81,12 +63,6 @@ pub enum ShortAuthenticationString {
|
|||||||
/// The emoji method.
|
/// The emoji method.
|
||||||
#[serde(rename = "emoji")]
|
#[serde(rename = "emoji")]
|
||||||
Emoji,
|
Emoji,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_enum! {
|
impl_enum! {
|
||||||
@ -102,12 +78,6 @@ pub enum VerificationMethod {
|
|||||||
/// The *m.sas.v1* verification method.
|
/// The *m.sas.v1* verification method.
|
||||||
#[serde(rename = "m.sas.v1")]
|
#[serde(rename = "m.sas.v1")]
|
||||||
MSasV1,
|
MSasV1,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_enum! {
|
impl_enum! {
|
||||||
|
@ -70,11 +70,6 @@ pub enum CancelCode {
|
|||||||
|
|
||||||
/// Any code that is not part of the specification.
|
/// Any code that is not part of the specification.
|
||||||
Custom(String),
|
Custom(String),
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for CancelCode {
|
impl Display for CancelCode {
|
||||||
@ -90,9 +85,6 @@ impl Display for CancelCode {
|
|||||||
CancelCode::InvalidMessage => "m.invalid_message",
|
CancelCode::InvalidMessage => "m.invalid_message",
|
||||||
CancelCode::Accepted => "m.accepted",
|
CancelCode::Accepted => "m.accepted",
|
||||||
CancelCode::Custom(ref cancel_code) => cancel_code,
|
CancelCode::Custom(ref cancel_code) => cancel_code,
|
||||||
CancelCode::__Nonexhaustive => {
|
|
||||||
panic!("__Nonexhaustive enum variant is not intended for use.")
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
write!(f, "{}", cancel_code_str)
|
write!(f, "{}", cancel_code_str)
|
||||||
|
@ -4,7 +4,6 @@ macro_rules! impl_enum {
|
|||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
|
||||||
let variant = match *self {
|
let variant = match *self {
|
||||||
$($name::$variant => $s,)*
|
$($name::$variant => $s,)*
|
||||||
$name::__Nonexhaustive => panic!("__Nonexhaustive enum variant is not intended for use."),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
write!(f, "{}", variant)
|
write!(f, "{}", variant)
|
||||||
|
@ -55,12 +55,6 @@ pub enum PresenceState {
|
|||||||
/// Connected to the service but not available for chat.
|
/// Connected to the service but not available for chat.
|
||||||
#[serde(rename = "unavailable")]
|
#[serde(rename = "unavailable")]
|
||||||
Unavailable,
|
Unavailable,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_enum! {
|
impl_enum! {
|
||||||
|
@ -124,11 +124,6 @@ pub enum PushCondition {
|
|||||||
/// This takes into account the current power levels in the room, ensuring the sender of the
|
/// This takes into account the current power levels in the room, ensuring the sender of the
|
||||||
/// event has high enough power to trigger the notification.
|
/// event has high enough power to trigger the notification.
|
||||||
SenderNotificationPermission(SenderNotificationPermissionCondition),
|
SenderNotificationPermission(SenderNotificationPermissionCondition),
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Serialize for PushCondition {
|
impl Serialize for PushCondition {
|
||||||
@ -149,9 +144,6 @@ impl Serialize for PushCondition {
|
|||||||
PushCondition::SenderNotificationPermission(ref condition) => {
|
PushCondition::SenderNotificationPermission(ref condition) => {
|
||||||
condition.serialize(serializer)
|
condition.serialize(serializer)
|
||||||
}
|
}
|
||||||
PushCondition::__Nonexhaustive => {
|
|
||||||
panic!("__Nonexhaustive enum variant is not intended for use.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ pub struct EncryptedEvent {
|
|||||||
|
|
||||||
/// The payload for `EncryptedEvent`.
|
/// The payload for `EncryptedEvent`.
|
||||||
#[derive(Clone, Debug, Serialize)]
|
#[derive(Clone, Debug, Serialize)]
|
||||||
|
#[non_exhaustive]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum EncryptedEventContent {
|
pub enum EncryptedEventContent {
|
||||||
/// An event encrypted with *m.olm.v1.curve25519-aes-sha2*.
|
/// An event encrypted with *m.olm.v1.curve25519-aes-sha2*.
|
||||||
@ -46,11 +47,6 @@ pub enum EncryptedEventContent {
|
|||||||
|
|
||||||
/// An event encrypted with *m.megolm.v1.aes-sha2*.
|
/// An event encrypted with *m.megolm.v1.aes-sha2*.
|
||||||
MegolmV1AesSha2(MegolmV1AesSha2Content),
|
MegolmV1AesSha2(MegolmV1AesSha2Content),
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromRaw for EncryptedEvent {
|
impl FromRaw for EncryptedEvent {
|
||||||
@ -79,9 +75,6 @@ impl FromRaw for EncryptedEventContent {
|
|||||||
EncryptedEventContent::OlmV1Curve25519AesSha2(content)
|
EncryptedEventContent::OlmV1Curve25519AesSha2(content)
|
||||||
}
|
}
|
||||||
MegolmV1AesSha2(content) => EncryptedEventContent::MegolmV1AesSha2(content),
|
MegolmV1AesSha2(content) => EncryptedEventContent::MegolmV1AesSha2(content),
|
||||||
__Nonexhaustive => {
|
|
||||||
unreachable!("__Nonexhaustive variant should be impossible to obtain.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,11 +130,6 @@ pub(crate) mod raw {
|
|||||||
|
|
||||||
/// An event encrypted with *m.megolm.v1.aes-sha2*.
|
/// An event encrypted with *m.megolm.v1.aes-sha2*.
|
||||||
MegolmV1AesSha2(MegolmV1AesSha2Content),
|
MegolmV1AesSha2(MegolmV1AesSha2Content),
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking
|
|
||||||
/// changes to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for EncryptedEventContent {
|
impl<'de> Deserialize<'de> for EncryptedEventContent {
|
||||||
@ -183,9 +171,6 @@ pub(crate) mod raw {
|
|||||||
Algorithm::Custom(_) => Err(D::Error::custom(
|
Algorithm::Custom(_) => Err(D::Error::custom(
|
||||||
"Custom algorithms are not supported by `EncryptedEventContent`.",
|
"Custom algorithms are not supported by `EncryptedEventContent`.",
|
||||||
)),
|
)),
|
||||||
Algorithm::__Nonexhaustive => Err(D::Error::custom(
|
|
||||||
"Attempted to deserialize __Nonexhaustive variant.",
|
|
||||||
)),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ ruma_event! {
|
|||||||
|
|
||||||
/// A policy for guest user access to a room.
|
/// A policy for guest user access to a room.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
|
||||||
|
#[non_exhaustive]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum GuestAccess {
|
pub enum GuestAccess {
|
||||||
/// Guests are allowed to join the room.
|
/// Guests are allowed to join the room.
|
||||||
@ -27,12 +28,6 @@ pub enum GuestAccess {
|
|||||||
|
|
||||||
/// Guests are not allowed to join the room.
|
/// Guests are not allowed to join the room.
|
||||||
Forbidden,
|
Forbidden,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_enum! {
|
impl_enum! {
|
||||||
|
@ -37,12 +37,6 @@ pub enum HistoryVisibility {
|
|||||||
/// All events while this is the `HistoryVisibility` value may be shared by any
|
/// All events while this is the `HistoryVisibility` value may be shared by any
|
||||||
/// participating homeserver with anyone, regardless of whether they have ever joined the room.
|
/// participating homeserver with anyone, regardless of whether they have ever joined the room.
|
||||||
WorldReadable,
|
WorldReadable,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_enum! {
|
impl_enum! {
|
||||||
|
@ -32,11 +32,7 @@ pub enum JoinRule {
|
|||||||
/// Anyone can join the room without any prior action.
|
/// Anyone can join the room without any prior action.
|
||||||
Public,
|
Public,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_enum! {
|
impl_enum! {
|
||||||
|
@ -80,12 +80,6 @@ pub enum MembershipState {
|
|||||||
|
|
||||||
/// The user has left.
|
/// The user has left.
|
||||||
Leave,
|
Leave,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_enum! {
|
impl_enum! {
|
||||||
@ -168,11 +162,6 @@ pub enum MembershipChange {
|
|||||||
|
|
||||||
/// Not implemented.
|
/// Not implemented.
|
||||||
NotImplemented,
|
NotImplemented,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MemberEvent {
|
impl MemberEvent {
|
||||||
@ -210,9 +199,6 @@ impl MemberEvent {
|
|||||||
(Leave, Invite) => MembershipChange::Invited,
|
(Leave, Invite) => MembershipChange::Invited,
|
||||||
(Ban, Leave) => MembershipChange::Unbanned,
|
(Ban, Leave) => MembershipChange::Unbanned,
|
||||||
(Knock, _) | (_, Knock) => MembershipChange::NotImplemented,
|
(Knock, _) | (_, Knock) => MembershipChange::NotImplemented,
|
||||||
(__Nonexhaustive, _) | (_, __Nonexhaustive) => {
|
|
||||||
panic!("__Nonexhaustive enum variant is not intended for use.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,11 +71,6 @@ pub enum MessageEventContent {
|
|||||||
|
|
||||||
/// A encrypted message.
|
/// A encrypted message.
|
||||||
Encrypted(EncryptedEventContent),
|
Encrypted(EncryptedEventContent),
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromRaw for MessageEvent {
|
impl FromRaw for MessageEvent {
|
||||||
@ -110,9 +105,6 @@ impl FromRaw for MessageEventContent {
|
|||||||
Text(content) => MessageEventContent::Text(content),
|
Text(content) => MessageEventContent::Text(content),
|
||||||
Video(content) => MessageEventContent::Video(content),
|
Video(content) => MessageEventContent::Video(content),
|
||||||
Encrypted(content) => MessageEventContent::Encrypted(content),
|
Encrypted(content) => MessageEventContent::Encrypted(content),
|
||||||
__Nonexhaustive => {
|
|
||||||
unreachable!("It should be impossible to obtain a __Nonexhaustive variant.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,11 +183,6 @@ pub(crate) mod raw {
|
|||||||
|
|
||||||
/// A video message.
|
/// A video message.
|
||||||
Encrypted(EncryptedEventContent),
|
Encrypted(EncryptedEventContent),
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for MessageEventContent {
|
impl<'de> Deserialize<'de> for MessageEventContent {
|
||||||
@ -237,11 +224,6 @@ pub(crate) mod raw {
|
|||||||
MessageType::ServerNotice => deserialize_content(content, Self::ServerNotice),
|
MessageType::ServerNotice => deserialize_content(content, Self::ServerNotice),
|
||||||
MessageType::Text => deserialize_content(content, Self::Text),
|
MessageType::Text => deserialize_content(content, Self::Text),
|
||||||
MessageType::Video => deserialize_content(content, Self::Video),
|
MessageType::Video => deserialize_content(content, Self::Video),
|
||||||
MessageType::__Nonexhaustive => {
|
|
||||||
return Err(D::Error::custom(
|
|
||||||
"Attempted to deserialize __Nonexhaustive variant.",
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.map_err(D::Error::custom)
|
.map_err(D::Error::custom)
|
||||||
}
|
}
|
||||||
@ -286,12 +268,6 @@ pub enum MessageType {
|
|||||||
/// A video message.
|
/// A video message.
|
||||||
#[serde(rename = "m.video")]
|
#[serde(rename = "m.video")]
|
||||||
Video,
|
Video,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The payload for an audio message.
|
/// The payload for an audio message.
|
||||||
@ -505,12 +481,6 @@ pub enum ServerNoticeType {
|
|||||||
/// The server has exceeded some limit which requires the server administrator to intervene.
|
/// The server has exceeded some limit which requires the server administrator to intervene.
|
||||||
#[serde(rename = "m.server_notice.usage_limit_reached")]
|
#[serde(rename = "m.server_notice.usage_limit_reached")]
|
||||||
UsageLimitReached,
|
UsageLimitReached,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Types of usage limits.
|
/// Types of usage limits.
|
||||||
@ -522,12 +492,6 @@ pub enum LimitType {
|
|||||||
/// New connections are being refused by the server. What defines "active" is left as an
|
/// New connections are being refused by the server. What defines "active" is left as an
|
||||||
/// implementation detail, however servers are encouraged to treat syncing users as "active".
|
/// implementation detail, however servers are encouraged to treat syncing users as "active".
|
||||||
MonthlyActiveUser,
|
MonthlyActiveUser,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The payload for a text message.
|
/// The payload for a text message.
|
||||||
|
@ -33,11 +33,7 @@ pub enum FeedbackType {
|
|||||||
/// Sent when a message has been observed by the end user.
|
/// Sent when a message has been observed by the end user.
|
||||||
Read,
|
Read,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_enum! {
|
impl_enum! {
|
||||||
|
@ -45,11 +45,7 @@ pub enum Action {
|
|||||||
#[serde(rename = "request_cancellation")]
|
#[serde(rename = "request_cancellation")]
|
||||||
CancelRequest,
|
CancelRequest,
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
|
||||||
/// to ruma-events.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_enum! {
|
impl_enum! {
|
||||||
|
@ -496,7 +496,6 @@ mod tests {
|
|||||||
|
|
||||||
let content = match &event.content {
|
let content = match &event.content {
|
||||||
StartEventContent::MSasV1(c) => c,
|
StartEventContent::MSasV1(c) => c,
|
||||||
_ => panic!("Key verification content deserialized into the wrong content type"),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
assert_eq!(content.from_device, "AliceDevice1");
|
assert_eq!(content.from_device, "AliceDevice1");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user