pub struct QueryWatcher { /* private fields */ }Expand description
Watches a query and emits updates when results change
Implementations§
Source§impl QueryWatcher
impl QueryWatcher
Sourcepub fn new(
collection: impl Into<String>,
listener: ChangeListener,
state: Arc<ReactiveQueryState>,
initial_results: Vec<Document>,
) -> Self
pub fn new( collection: impl Into<String>, listener: ChangeListener, state: Arc<ReactiveQueryState>, initial_results: Vec<Document>, ) -> Self
Create a new query watcher
§Arguments
collection- Collection to watchlistener- Change listener for the collectionstate- Reactive query stateinitial_results- Initial query results to populate the state
Sourcepub async fn next(&mut self) -> Option<QueryUpdate>
pub async fn next(&mut self) -> Option<QueryUpdate>
Get the next query update Returns None when the watcher is closed
Sourcepub fn collection(&self) -> &str
pub fn collection(&self) -> &str
Get the collection name being watched
Sourcepub fn try_next(&mut self) -> Option<QueryUpdate>
pub fn try_next(&mut self) -> Option<QueryUpdate>
Try to receive an update without blocking
Auto Trait Implementations§
impl Freeze for QueryWatcher
impl RefUnwindSafe for QueryWatcher
impl Send for QueryWatcher
impl Sync for QueryWatcher
impl Unpin for QueryWatcher
impl UnwindSafe for QueryWatcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more