events: Add missing ctor / From impl for EncryptedToDeviceEventContent

This commit is contained in:
Jonas Platte 2021-08-11 21:08:24 +02:00
parent ea2ee79aa0
commit 6177bfccef
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
2 changed files with 18 additions and 0 deletions

View File

@ -1,5 +1,10 @@
# [unreleased] # [unreleased]
Improvements:
* Add missing constructor and `From` implementation for
`EncryptedToDeviceEventContent`
# 0.24.1 # 0.24.1
Breaking changes: Breaking changes:

View File

@ -60,6 +60,19 @@ pub struct EncryptedToDeviceEventContent {
pub scheme: EncryptedEventScheme, pub scheme: EncryptedEventScheme,
} }
impl EncryptedToDeviceEventContent {
/// Creates a new `EncryptedToDeviceEventContent` with the given scheme.
pub fn new(scheme: EncryptedEventScheme) -> Self {
Self { scheme }
}
}
impl From<EncryptedEventScheme> for EncryptedToDeviceEventContent {
fn from(scheme: EncryptedEventScheme) -> Self {
Self { scheme }
}
}
/// The encryption scheme for `EncryptedEventContent`. /// The encryption scheme for `EncryptedEventContent`.
#[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)]