Mark AvatarEventContent as non_exhaustive

This commit is contained in:
Jonas Platte 2020-07-16 23:29:09 +02:00
parent 1db0082281
commit c9c56c3404
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
2 changed files with 9 additions and 0 deletions

View File

@ -13,6 +13,7 @@ pub type AvatarEvent = StateEvent<AvatarEventContent>;
/// The payload for `AvatarEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
#[non_exhaustive]
#[ruma_event(type = "m.room.avatar")]
pub struct AvatarEventContent {
/// Information about the avatar image.
@ -23,3 +24,10 @@ pub struct AvatarEventContent {
/// URL of the avatar image.
pub url: String,
}
impl AvatarEventContent {
/// Create an `AvatarEventContent` from the given image URL.
pub fn new(url: String) -> Self {
Self { info: None, url }
}
}

View File

@ -193,6 +193,7 @@ fn deserialize_avatar_without_prev_content() {
content: AnyStateEventContent::RoomAvatar(AvatarEventContent {
info: Some(info),
url,
..
}),
event_id,
origin_server_ts,