pub struct LiveQuery<T, E> { /* private fields */ }Expand description
A subscription’s results and lifetime; dropping it ends future runs. Its
results fail with E, the query closure’s own error type.
Implementations§
Source§impl<T, E> LiveQuery<T, E>
impl<T, E> LiveQuery<T, E>
Sourcepub fn new(inner: ReconfigurableLiveQuery<(), T, E>) -> LiveQuery<T, E>
pub fn new(inner: ReconfigurableLiveQuery<(), T, E>) -> LiveQuery<T, E>
The query inner runs, with no request to replace.
Sourcepub fn changed(&self) -> impl Future<Output = ()> + Send + 'static
pub fn changed(&self) -> impl Future<Output = ()> + Send + 'static
Resolves once next_blocking has something to do: a commit changed
what the last run read, the handle failed or closed, the query ended,
or no run has answered yet. Dropping it loses nothing, and it needs no
runtime.
Sourcepub fn run_changed(&mut self) -> Option<Result<T, E>>
pub fn run_changed(&mut self) -> Option<Result<T, E>>
Runs the query once if a commit changed what its last run read or no
run has answered yet. Returns None when nothing changed, when a
write-caused result equals the last one, and once the query has ended.
Never parks.
Sourcepub fn has_ended(&self) -> bool
pub fn has_ended(&self) -> bool
Whether the database closed, the handle failed or a run’s error carried a bug, and a result said so: the query answers nothing more.
Sourcepub fn next_blocking(&mut self) -> Option<Result<T, E>>
pub fn next_blocking(&mut self) -> Option<Result<T, E>>
Returns the first result at once, and after that only results that
changed. The call parks this thread until changed would resolve,
then runs the query on it.
Errors remain results and don’t end the query, except the one
reporting that the database closed, the handle failed or a run’s error
carries a bug, as a panic’s does: after it, None.
Sourcepub async fn next_inline(&mut self) -> Option<Result<T, E>>
pub async fn next_inline(&mut self) -> Option<Result<T, E>>
next_blocking for a test on an async executor.
Sourcepub fn bugs(&self) -> &Arc<dyn BugSink> ⓘ
pub fn bugs(&self) -> &Arc<dyn BugSink> ⓘ
Where a bug in a result nobody waits for any more goes (E15).
Sourcepub fn runs(&self) -> LiveQueryRuns
pub fn runs(&self) -> LiveQueryRuns
How often this query has run so far.
Sourcepub fn is_marked_for_rerun(&self) -> bool
pub fn is_marked_for_rerun(&self) -> bool
Whether a commit since this idle query’s last result changes what it reads, so asking for its next result runs it again, with no waiting.