1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Contains the observer pattern, used to subscribe to updates on
//! [`Peer`](crate::transport::Peer)s, [`Collection`](crate::store::collection::Collection)s, and
//! the file system.

/// Observers are objects that must be kept in scope to keep observing changes relating to a
/// [`Ditto`](crate::prelude::Ditto) instance, such as
/// [`Subscription`](crate::prelude::Subscription)s,
/// [`PresenceObserver`](crate::prelude::PresenceObserver)s, or
/// [`LiveQuery`](crate::prelude::LiveQuery)s.
pub trait Observer: Sized {
    /// Stop the observer so that it no longer receive updates
    fn stop(self) {
        // By taking ownership of the observer, we ensure it gets dropped
    }
}