events: Make IgnoredUserListEventContent non-exhaustive
This commit is contained in:
parent
914279010a
commit
5b0c675cb8
@ -11,6 +11,7 @@ pub type IgnoredUserListEvent = BasicEvent<IgnoredUserListEventContent>;
|
|||||||
|
|
||||||
/// The payload for `IgnoredUserListEvent`.
|
/// The payload for `IgnoredUserListEvent`.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, BasicEventContent)]
|
#[derive(Clone, Debug, Deserialize, Serialize, BasicEventContent)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
#[ruma_event(type = "m.ignored_user_list")]
|
#[ruma_event(type = "m.ignored_user_list")]
|
||||||
pub struct IgnoredUserListEventContent {
|
pub struct IgnoredUserListEventContent {
|
||||||
/// A list of users to ignore.
|
/// A list of users to ignore.
|
||||||
@ -18,6 +19,13 @@ pub struct IgnoredUserListEventContent {
|
|||||||
pub ignored_users: Vec<UserId>,
|
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use matches::assert_matches;
|
use matches::assert_matches;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user