Skip to main content

next_result

Function next_result 

Source
pub async fn next_result<T, E>(
    query: LiveQuery<T, E>,
) -> (LiveQuery<T, E>, Option<Result<T, E>>)
where T: Clone + PartialEq + Send + 'static, E: From<DbError> + CarriesBug + Send + 'static,
Expand description

The query’s next result, with the query to ask again: it waits for changed() on the executor, runs run_changed on tokio’s blocking pool, and waits again when a write-caused result equals the last, so no pool thread waits. The function returns None once the query has ended (E15). When the pool has begun shutting down, it returns Some(Err(DbError::Shutdown)), and when a panic happens outside the run itself, it returns Some(Err(DbError::Bug)).

Dropping this future loses the query, since the pool’s thread holds it. A run that has already started ends on its own thread, and a bug in its result goes to the store’s bug sink (E15).