#[non_exhaustive]pub enum Relation {
Reply(Reply),
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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Reply(Reply)
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 a rel_type field.
Sourcepub fn data(&self) -> Cow<'_, JsonObject>
pub fn data(&self) -> Cow<'_, JsonObject>
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<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<RelationWithoutReplacement> for Relation
impl From<RelationWithoutReplacement> for Relation
Source§fn from(value: RelationWithoutReplacement) -> Self
fn from(value: RelationWithoutReplacement) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Relation
impl RefUnwindSafe for Relation
impl Send for Relation
impl Sync for Relation
impl Unpin for Relation
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<> Read more