From b36a9ad78162e5a33c124f58f4f4e2dd74e0a86f Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 2 Oct 2024 09:18:29 +0100 Subject: [PATCH] timeline: Add documentation to `[Sync]TimelineEvent` I found it hard to understand what these two structs were for, so let's start by giving them some documentation. --- .../src/deserialized_responses.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/crates/matrix-sdk-common/src/deserialized_responses.rs b/crates/matrix-sdk-common/src/deserialized_responses.rs index e01ea2983..394f13bb5 100644 --- a/crates/matrix-sdk-common/src/deserialized_responses.rs +++ b/crates/matrix-sdk-common/src/deserialized_responses.rs @@ -297,8 +297,11 @@ pub struct EncryptionInfo { pub verification_state: VerificationState, } -/// A customized version of a room event coming from a sync that holds optional -/// encryption info. +/// Represents a matrix room event that has been returned from `/sync`, +/// after initial processing. +/// +/// This is almost identical to [`TimelineEvent`], but wraps an +/// [`AnySyncTimelineEvent`] instead of [`AnyTimelineEvent`]. #[derive(Clone, Deserialize, Serialize)] pub struct SyncTimelineEvent { /// The actual event. @@ -388,6 +391,16 @@ impl From for SyncTimelineEvent { } } +/// Represents a matrix room event that has been returned from a Matrix +/// client-server API endpoint such as `/messages`, after initial processing. +/// +/// The "initial processing" includes an attempt to decrypt encrypted events, so +/// the main thing this adds over [`AnyTimelineEvent`] is information on +/// encryption. +/// +/// See also [`SyncTimelineEvent`] which is almost identical, but is used for +/// results from the `/sync` endpoint (which lack a `room_id` property) and +/// hence wraps an [`AnySyncTimelineEvent`] instead of [`AnyTimelineEvent`]. #[derive(Clone)] pub struct TimelineEvent { /// The actual event.