Mark AvatarEventContent as non_exhaustive
This commit is contained in:
parent
1db0082281
commit
c9c56c3404
@ -13,6 +13,7 @@ pub type AvatarEvent = StateEvent<AvatarEventContent>;
|
|||||||
|
|
||||||
/// The payload for `AvatarEvent`.
|
/// The payload for `AvatarEvent`.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||||
|
#[non_exhaustive]
|
||||||
#[ruma_event(type = "m.room.avatar")]
|
#[ruma_event(type = "m.room.avatar")]
|
||||||
pub struct AvatarEventContent {
|
pub struct AvatarEventContent {
|
||||||
/// Information about the avatar image.
|
/// Information about the avatar image.
|
||||||
@ -23,3 +24,10 @@ pub struct AvatarEventContent {
|
|||||||
/// URL of the avatar image.
|
/// URL of the avatar image.
|
||||||
pub url: String,
|
pub url: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AvatarEventContent {
|
||||||
|
/// Create an `AvatarEventContent` from the given image URL.
|
||||||
|
pub fn new(url: String) -> Self {
|
||||||
|
Self { info: None, url }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -193,6 +193,7 @@ fn deserialize_avatar_without_prev_content() {
|
|||||||
content: AnyStateEventContent::RoomAvatar(AvatarEventContent {
|
content: AnyStateEventContent::RoomAvatar(AvatarEventContent {
|
||||||
info: Some(info),
|
info: Some(info),
|
||||||
url,
|
url,
|
||||||
|
..
|
||||||
}),
|
}),
|
||||||
event_id,
|
event_id,
|
||||||
origin_server_ts,
|
origin_server_ts,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user