ruwuma/tests/ruma_events_macros.rs
2019-06-19 16:08:43 -07:00

56 lines
1.6 KiB
Rust

// See note about wrapping macro expansion in a module from `src/lib.rs`
pub mod common_case {
use ruma_events_macros::ruma_event;
ruma_event! {
/// Informs the room about what room aliases it has been given.
AliasesEvent {
kind: StateEvent,
event_type: RoomAliases,
content: {
/// A list of room aliases.
pub aliases: Vec<ruma_identifiers::RoomAliasId>,
}
}
}
}
pub mod extra_fields {
use ruma_events_macros::ruma_event;
ruma_event! {
/// A redaction of an event.
RedactionEvent {
kind: RoomEvent,
event_type: RoomRedaction,
fields: {
/// The ID of the event that was redacted.
pub redacts: ruma_identifiers::EventId
},
content: {
/// The reason for the redaction, if any.
pub reason: Option<String>,
},
}
}
}
pub mod type_alias {
use ruma_events_macros::ruma_event;
ruma_event! {
/// Informs the client about the rooms that are considered direct by a user.
DirectEvent {
kind: Event,
event_type: Direct,
content_type_alias: {
/// The payload of a `DirectEvent`.
///
/// A mapping of `UserId`'s to a collection of `RoomId`'s which are considered
/// *direct* for that particular user.
std::collections::HashMap<ruma_identifiers::UserId, Vec<ruma_identifiers::RoomId>>
}
}
}
}