#[derive(EventContent)]
{
// Attributes available to this derive:
#[ruma_event]
}
Expand description
Generates an implementation of ruma_events::EventContent
.
Also generates type aliases depending on the kind of event, with the final Content
of the type
name removed and prefixed added. For instance, a message-like event content type
FooEventContent
will have the following aliases generated:
type FooEvent = MessageLikeEvent<FooEventContent>
type SyncFooEvent = SyncMessageLikeEvent<FooEventContent>
type OriginalFooEvent = OriginalMessageLikeEvent<FooEventContent>
type OriginalSyncFooEvent = OriginalSyncMessageLikeEvent<FooEventContent>
type RedactedFooEvent = RedactedMessageLikeEvent<FooEventContent>
type RedactedSyncFooEvent = RedactedSyncMessageLikeEvent<FooEventContent>
You can use cargo doc
to find out more details, its --document-private-items
flag also lets
you generate documentation for binaries or private parts of a library.
By default, the type this macro is used on and the generated types get a #[non_exhaustive]
attribute. This behavior can be controlled by setting the ruma_unstable_exhaustive_types
compile-time cfg
setting as --cfg=ruma_unstable_exhaustive_types
using RUSTFLAGS
or
.cargo/config.toml
(under [build]
-> rustflags = ["..."]
). When that setting is
activated, the attribute is not applied so the types are exhaustive.