pub struct LiveQuery<T> { /* private fields */ }Expand description
A query over the store’s reader that runs initially and whenever a committed row change can affect its result.
Construct one with CovenHandle::subscribe,
then call next for the initial value and each later value.
Query errors are values in the sequence and do not end the subscription.
Implementations§
Source§impl<T> LiveQuery<T>where
T: Send + 'static,
impl<T> LiveQuery<T>where
T: Send + 'static,
Sourcepub fn process<P, R>(self, process: P) -> LiveQuery<R>
pub fn process<P, R>(self, process: P) -> LiveQuery<R>
Process each fetched value after releasing the database connection.
Only the processed result needs to implement Clone and PartialEq
to deliver values through next.
The returned subscription delivers an initial processed result even if this subscription previously delivered unprocessed values.
Sourcepub async fn next(&mut self) -> CovenResult<T>
pub async fn next(&mut self) -> CovenResult<T>
Return the query’s initial value, or wait for a committed change that can affect it and return the value after that commit. A commit whose rerun produces the value already returned is not a value; the wait continues.
Auto Trait Implementations§
impl<T> Freeze for LiveQuery<T>where
T: Freeze,
impl<T> !RefUnwindSafe for LiveQuery<T>
impl<T> Send for LiveQuery<T>where
T: Send,
impl<T> Sync for LiveQuery<T>where
T: Sync,
impl<T> Unpin for LiveQuery<T>where
T: Unpin,
impl<T> UnsafeUnpin for LiveQuery<T>where
T: UnsafeUnpin,
impl<T> !UnwindSafe for LiveQuery<T>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more