pub enum Relation {
Reply {
in_reply_to: InReplyTo,
},
Replacement(Replacement),
Reference(Reference),
Annotation(Annotation),
Thread(Thread),
// some variants omitted
}
events
only.Expand description
Relationship information about an encrypted event.
Outside of the encrypted payload to support server aggregation.
Variants§
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§
source§impl Relation
impl Relation
sourcepub 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.
sourcepub fn data(&self) -> Cow<'_, Map<String, Value>>
pub fn data(&self) -> Cow<'_, Map<String, Value>>
The associated data.
The returned JSON object holds the contents of m.relates_to
, including rel_type
and
event_id
if present, but not things like m.new_content
for m.replace
relations that
live next to m.relates_to
.
Prefer to use the public variants of Relation
where possible; this method is meant to
be used for custom relations only.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Relation
impl<'de> Deserialize<'de> for Relation
source§fn deserialize<D>(
deserializer: D,
) -> Result<Relation, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Relation, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
source§impl Serialize for Relation
impl Serialize for Relation
source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Auto Trait Implementations§
impl Freeze for Relation
impl RefUnwindSafe for Relation
impl Send for Relation
impl Sync for Relation
impl Unpin for Relation
impl UnwindSafe for Relation
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more