doc(sdk): Specify how the Client::observe_events works.

This commit is contained in:
Ivan Enderlin
2024-11-25 11:01:44 +01:00
parent 079ec023b7
commit 9d6ffa951f
2 changed files with 11 additions and 0 deletions

View File

@@ -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<Ev, Ctx>(
&self,
room_id: &RoomId,

View File

@@ -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)]