Skip to main content

RelatesTo

Enum RelatesTo 

Source
pub enum RelatesTo {
    Annotation {
        event_id: EventId,
        key: String,
    },
    Replace {
        event_id: EventId,
    },
    Thread {
        event_id: EventId,
        is_falling_back: bool,
        in_reply_to: Option<InReplyTo>,
    },
    InReplyTo(InReplyTo),
    Unknown(Value),
}
Expand description

One event’s m.relates_to field, parsed into the shape its rel_type (or, for the legacy reply pointer, the absence of one) implies. Never fails to parse: an m.relates_to value that matches none of the shapes below becomes RelatesTo::Unknown, carrying the raw value.

Variants§

§

Annotation

m.annotation (reactions): key is the reaction’s own content (e.g. an emoji), event_id the event being reacted to.

Fields

§event_id: EventId

The event being annotated.

§key: String

The annotation’s key (an emoji, for m.reaction).

§

Replace

m.replace (edits, MSC2676): event_id is the event being replaced. The replacement content itself lives at the top level of the edit event’s own content, under m.new_content — not part of this type, since that key sits alongside m.relates_to, not inside it.

Fields

§event_id: EventId

The event being replaced.

§

Thread

m.thread (MSC3440).

Fields

§event_id: EventId

The thread’s root event.

§is_falling_back: bool

true if this reply also sets m.in_reply_to purely for clients without threading UI, and should not be shown twice by a client that does understand threads.

§in_reply_to: Option<InReplyTo>

The specific event within the thread this one is a rich reply to, if any.

§

InReplyTo(InReplyTo)

The legacy rich-reply pointer (m.in_reply_to with no rel_type alongside it) — still sent for backward compatibility even when an event carries a “real” relation.

§

Unknown(Value)

An m.relates_to value present but not matching any shape above — kept verbatim rather than rejected (module doc).

Implementations§

Source§

impl RelatesTo

Source

pub fn from_content(content: &Value) -> Option<Self>

Extracts and parses content["m.relates_to"], if present. Returns None only when the field itself is absent — most events don’t relate to anything. See this type’s own doc for what happens when the field is present but unrecognized.

Trait Implementations§

Source§

impl Clone for RelatesTo

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RelatesTo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RelatesTo

Source§

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 PartialEq for RelatesTo

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for RelatesTo

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for RelatesTo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V