Mark CanonicalAliasEventContent as non_exhaustive
This commit is contained in:
parent
c9c56c3404
commit
7216cbd5bd
@ -111,6 +111,7 @@
|
|||||||
|
|
||||||
#![recursion_limit = "1024"]
|
#![recursion_limit = "1024"]
|
||||||
#![warn(missing_debug_implementations, missing_docs, rust_2018_idioms)]
|
#![warn(missing_debug_implementations, missing_docs, rust_2018_idioms)]
|
||||||
|
#![allow(clippy::new_without_default)] // lint is no good
|
||||||
// Since we support Rust 1.36.0, we can't apply this suggestion yet
|
// Since we support Rust 1.36.0, we can't apply this suggestion yet
|
||||||
#![allow(clippy::use_self)]
|
#![allow(clippy::use_self)]
|
||||||
// Remove this once https://github.com/rust-lang/rust/issues/54883 becomes stable
|
// Remove this once https://github.com/rust-lang/rust/issues/54883 becomes stable
|
||||||
|
@ -11,6 +11,7 @@ pub type CanonicalAliasEvent = StateEvent<CanonicalAliasEventContent>;
|
|||||||
|
|
||||||
/// The payload for `CanonicalAliasEvent`.
|
/// The payload for `CanonicalAliasEvent`.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||||
|
#[non_exhaustive]
|
||||||
#[ruma_event(type = "m.room.canonical_alias")]
|
#[ruma_event(type = "m.room.canonical_alias")]
|
||||||
pub struct CanonicalAliasEventContent {
|
pub struct CanonicalAliasEventContent {
|
||||||
/// The canonical alias.
|
/// The canonical alias.
|
||||||
@ -29,6 +30,13 @@ pub struct CanonicalAliasEventContent {
|
|||||||
pub alt_aliases: Vec<RoomAliasId>,
|
pub alt_aliases: Vec<RoomAliasId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CanonicalAliasEventContent {
|
||||||
|
/// Creates an empty `CanonicalAliasEventContent`.
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self { alias: None, alt_aliases: Vec::new() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::{
|
use std::{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user