events: Make IgnoredUserListEventContent non-exhaustive

This commit is contained in:
Jonas Platte 2021-04-01 01:45:07 +02:00
parent 914279010a
commit 5b0c675cb8
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -11,6 +11,7 @@ pub type IgnoredUserListEvent = BasicEvent<IgnoredUserListEventContent>;
/// The payload for `IgnoredUserListEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, BasicEventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "m.ignored_user_list")]
pub struct IgnoredUserListEventContent {
/// A list of users to ignore.
@ -18,6 +19,13 @@ pub struct IgnoredUserListEventContent {
pub ignored_users: Vec<UserId>,
}
impl IgnoredUserListEventContent {
/// Creates a new `IgnoredUserListEventContent` from the given user IDs.
pub fn new(ignored_users: Vec<UserId>) -> Self {
Self { ignored_users }
}
}
#[cfg(test)]
mod tests {
use matches::assert_matches;