From 9d6ffa951f7f4fac9a0c2c2cf15edb6cc7d64d5b Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Mon, 25 Nov 2024 11:01:44 +0100 Subject: [PATCH] doc(sdk): Specify how the `Client::observe_events` works. --- crates/matrix-sdk/src/client/mod.rs | 8 ++++++++ crates/matrix-sdk/src/event_handler/mod.rs | 3 +++ 2 files changed, 11 insertions(+) diff --git a/crates/matrix-sdk/src/client/mod.rs b/crates/matrix-sdk/src/client/mod.rs index a16603c02..9c4b948b8 100644 --- a/crates/matrix-sdk/src/client/mod.rs +++ b/crates/matrix-sdk/src/client/mod.rs @@ -807,6 +807,10 @@ impl Client { /// implements a [`Stream`]. The `Stream::Item` will be of type `(Ev, /// Ctx)`. /// + /// Be careful that only the most recent value can be observed. Subscribers + /// are notified when a new value is sent, but there is no guarantee + /// that they will see all values. + /// /// # Example /// /// Let's see a classical usage: @@ -879,6 +883,10 @@ impl Client { /// This method works the same way as [`Client::observe_events`], except /// that the observability will only be applied for events in the room with /// the specified ID. See that method for more details. + /// + /// Be careful that only the most recent value can be observed. Subscribers + /// are notified when a new value is sent, but there is no guarantee + /// that they will see all values. pub fn observe_room_events( &self, room_id: &RoomId, diff --git a/crates/matrix-sdk/src/event_handler/mod.rs b/crates/matrix-sdk/src/event_handler/mod.rs index 83bffe255..ec1676f39 100644 --- a/crates/matrix-sdk/src/event_handler/mod.rs +++ b/crates/matrix-sdk/src/event_handler/mod.rs @@ -541,6 +541,9 @@ impl_event_handler!(A, B, C, D, E, F, G, H); /// An observer of events (may be tailored to a room). /// +/// Only the most recent value can be observed. Subscribers are notified when a +/// new value is sent, but there is no guarantee that they will see all values. +/// /// To create such observer, use [`Client::observe_events`] or /// [`Client::observe_room_events`]. #[derive(Debug)]