Mark EncryptionEventContent as non_exhaustive

This commit is contained in:
Jonas Platte 2020-07-17 01:20:41 +02:00
parent 34e89f4d11
commit b31a6eac65
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -11,6 +11,7 @@ pub type EncryptionEvent = StateEvent<EncryptionEventContent>;
/// The payload for `EncryptionEvent`. /// The payload for `EncryptionEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
#[non_exhaustive]
#[ruma_event(type = "m.room.encryption")] #[ruma_event(type = "m.room.encryption")]
pub struct EncryptionEventContent { pub struct EncryptionEventContent {
/// The encryption algorithm to be used to encrypt messages sent in this room. /// The encryption algorithm to be used to encrypt messages sent in this room.
@ -30,3 +31,10 @@ pub struct EncryptionEventContent {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub rotation_period_msgs: Option<UInt>, pub rotation_period_msgs: Option<UInt>,
} }
impl EncryptionEventContent {
/// Creates a new `EncryptionEventContent` with the given algorithm.
pub fn new(algorithm: Algorithm) -> Self {
Self { algorithm, rotation_period_ms: None, rotation_period_msgs: None }
}
}