events: Add constructors for ParentEventContent
and ChildEventContent
This commit is contained in:
parent
9a24f9edbd
commit
2e88e48eb3
@ -14,7 +14,7 @@ use crate::StateEvent;
|
||||
pub type ChildEvent = StateEvent<ChildEventContent>;
|
||||
|
||||
/// The payload for `ChildEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.space.child", kind = State)]
|
||||
pub struct ChildEventContent {
|
||||
@ -44,6 +44,13 @@ pub struct ChildEventContent {
|
||||
pub suggested: Option<bool>,
|
||||
}
|
||||
|
||||
impl ChildEventContent {
|
||||
/// Creates a new `ChildEventContent`.
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::ChildEventContent;
|
||||
|
@ -32,6 +32,13 @@ pub struct ParentEventContent {
|
||||
pub canonical: bool,
|
||||
}
|
||||
|
||||
impl ParentEventContent {
|
||||
/// Creates a new `ParentEventContent` with the given canonical flag.
|
||||
pub fn new(canonical: bool) -> Self {
|
||||
Self { via: None, canonical }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::ParentEventContent;
|
||||
|
Loading…
x
Reference in New Issue
Block a user