#[non_exhaustive]pub enum Relation {
Reply {
in_reply_to: InReplyTo,
},
Replacement(Replacement),
Reference(Reference),
Annotation(Annotation),
Thread(Thread),
}
Expand description
Relationship information about an encrypted event.
Outside of the encrypted payload to support server aggregation.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Reply
An m.in_reply_to
relation indicating that the event is a reply to another event.
Replacement(Replacement)
An event that replaces another event.
Reference(Reference)
A reference to another event.
Annotation(Annotation)
An annotation to an event.
Thread(Thread)
An event that belongs to a thread.
Implementations§
§impl Relation
impl Relation
pub fn rel_type(&self) -> Option<RelationType>
pub fn rel_type(&self) -> Option<RelationType>
The type of this Relation
.
Returns an Option
because the Reply
relation does not have arel_type
field.
pub fn event_id(&self) -> &EventId
👎Deprecated: Please open an issue if you use this
pub fn event_id(&self) -> &EventId
The ID of the event this relates to.
This is the event_id
field at the root of an m.relates_to
object, except in the case of
a reply relation where it’s the event_id
field in the m.in_reply_to
object.
pub fn data(&self) -> Cow<'_, Map<String, Value>>
pub fn data(&self) -> Cow<'_, Map<String, Value>>
The associated data.
The returned JSON object won’t contain the rel_type
field, use
.rel_type()
to access it. It also won’t contain data
outside of m.relates_to
(e.g. m.new_content
for m.replace
relations).
Prefer to use the public variants of Relation
where possible; this method is meant to
be used for custom relations only.