pub struct TasksWatcher { /* private fields */ }Expand description
Reactive filter over TasksState. Created via
super::TasksAdapter::watch.
Implementations§
Source§impl TasksWatcher
impl TasksWatcher
Sourcepub fn where_status(self, status: TaskStatus) -> TasksWatcher
pub fn where_status(self, status: TaskStatus) -> TasksWatcher
Restrict to tasks with the given status.
Sourcepub fn where_id_in(self, ids: impl IntoIterator<Item = u64>) -> TasksWatcher
pub fn where_id_in(self, ids: impl IntoIterator<Item = u64>) -> TasksWatcher
Restrict to tasks whose id is in the provided collection.
Sourcepub fn created_after(self, ns: u64) -> TasksWatcher
pub fn created_after(self, ns: u64) -> TasksWatcher
Restrict to created_ns >= ns (inclusive).
Sourcepub fn created_before(self, ns: u64) -> TasksWatcher
pub fn created_before(self, ns: u64) -> TasksWatcher
Restrict to created_ns <= ns (inclusive).
Sourcepub fn updated_after(self, ns: u64) -> TasksWatcher
pub fn updated_after(self, ns: u64) -> TasksWatcher
Restrict to updated_ns >= ns (inclusive).
Sourcepub fn updated_before(self, ns: u64) -> TasksWatcher
pub fn updated_before(self, ns: u64) -> TasksWatcher
Restrict to updated_ns <= ns (inclusive).
Sourcepub fn title_contains(self, needle: impl Into<String>) -> TasksWatcher
pub fn title_contains(self, needle: impl Into<String>) -> TasksWatcher
Restrict to tasks whose title contains needle (case-insensitive).
Sourcepub fn order_by(self, order: OrderBy) -> TasksWatcher
pub fn order_by(self, order: OrderBy) -> TasksWatcher
Order each emitted result set.
Sourcepub fn limit(self, n: usize) -> TasksWatcher
pub fn limit(self, n: usize) -> TasksWatcher
Truncate each emitted result set to n after ordering.
Sourcepub fn stream(self) -> impl Stream<Item = Vec<Task>> + Send + 'static
pub fn stream(self) -> impl Stream<Item = Vec<Task>> + Send + 'static
Start emitting. The stream yields:
- The current filter result immediately (first element).
- A new result vector on each subsequent fold tick where the filter’s result differs from the previously emitted one.
Backing channel is single-slot: if the consumer falls behind
a fast fold task, intermediate filter results are dropped and
the consumer sees the latest state on the next poll. Same
“drop intermediate, final state is correct” semantic as
crate::adapter::net::cortex::CortexAdapter::changes.
If order_by was not set, the watcher defaults to IdAsc
so Vec-equality dedup is deterministic — otherwise HashMap
iteration order could produce spurious re-emissions.
The stream ends when the adapter’s change stream ends (e.g. when all adapter handles drop and the fold task exits).