Ragotzy.devin 5e428ac95a
Add support for redacted events
* Generate redacted event enums and implement corresponding event structs
* Enable the *EventContent derives to generate redacted events

  Most redacted event code is now generated by the *EventContent derive
  macro. The exception are any content structs with the custom_redaction
  attribute. This leaves implementing up to the user.
* Add redact method to Redaction/CustomEventContent
* Add accessor methods for redacted event enums
* Add RedactedEventContent trait and super traits to match EventContent
2020-07-11 14:59:36 +02:00

31 lines
818 B
Rust

//! Types for the *m.tag* event.
use std::collections::BTreeMap;
use ruma_events_macros::BasicEventContent;
use serde::{Deserialize, Serialize};
use crate::BasicEvent;
/// Informs the client of tags on a room.
pub type TagEvent = BasicEvent<TagEventContent>;
/// Map of tag names to tag info.
pub type Tags = BTreeMap<String, TagInfo>;
/// The payload for `TagEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, BasicEventContent)]
#[ruma_event(type = "m.tag")]
pub struct TagEventContent {
/// A map of tag names to tag info.
pub tags: Tags,
}
/// Information about a tag.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TagInfo {
/// Value to use for lexicographically ordering rooms with this tag.
#[serde(skip_serializing_if = "Option::is_none")]
pub order: Option<f64>,
}