ruma_events/policy/rule/
server.rs

1//! Types for the [`m.policy.rule.server`] event.
2//!
3//! [`m.policy.rule.server`]: https://spec.matrix.org/latest/client-server-api/#mpolicyruleserver
4
5use ruma_macros::EventContent;
6use serde::{Deserialize, Serialize};
7
8use super::{PolicyRuleEventContent, PossiblyRedactedPolicyRuleEventContent};
9use crate::{EventContent, PossiblyRedactedStateEventContent, StateEventType};
10
11/// The content of an `m.policy.rule.server` event.
12///
13/// This event type is used to apply rules to server entities.
14#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
15#[allow(clippy::exhaustive_structs)]
16#[ruma_event(type = "m.policy.rule.server", kind = State, state_key_type = String, custom_possibly_redacted)]
17pub struct PolicyRuleServerEventContent(pub PolicyRuleEventContent);
18
19/// The possibly redacted form of [`PolicyRuleServerEventContent`].
20///
21/// This type is used when it's not obvious whether the content is redacted or not.
22#[derive(Clone, Debug, Deserialize, Serialize)]
23#[allow(clippy::exhaustive_structs)]
24pub struct PossiblyRedactedPolicyRuleServerEventContent(pub PossiblyRedactedPolicyRuleEventContent);
25
26impl EventContent for PossiblyRedactedPolicyRuleServerEventContent {
27    type EventType = StateEventType;
28
29    fn event_type(&self) -> Self::EventType {
30        StateEventType::PolicyRuleServer
31    }
32}
33
34impl PossiblyRedactedStateEventContent for PossiblyRedactedPolicyRuleServerEventContent {
35    type StateKey = String;
36}