pub struct Query { /* private fields */ }Expand description
Handle to an in-flight query.
Dropping the handle implicitly cancels the query.
Implementations§
Source§impl Query
impl Query
Sourcepub const fn handle(&self) -> QueryHandle
pub const fn handle(&self) -> QueryHandle
The underlying proto-layer query handle.
Sourcepub fn dropped_answers(&self) -> u64
pub fn dropped_answers(&self) -> u64
Number of answers dropped so far because the per-query backlog filled.
Monotonic for the life of the query. A non-zero, growing
value means the consumer is not keeping up with a burst of answers and
some QueryEvent::Answer values were discarded; see that variant for
the lossy-stream contract.
Sourcepub async fn next(&mut self) -> Option<QueryEvent>
pub async fn next(&mut self) -> Option<QueryEvent>
Wait for the next answer or terminal. Returns None once the query has
ended (terminal delivered) or the driver task has exited.
Single-consumer: this takes &mut self, so there is at most one
in-flight next() future per Query. That is deliberate — the wakeup
path assumes one waiter, and it makes the lossy-stream contract on
QueryEvent::Answer the only source of gaps.
Sourcepub async fn cancel(self) -> Result<(), CancelError>
pub async fn cancel(self) -> Result<(), CancelError>
Explicitly cancel the query. Equivalent to dropping the handle but returns an error if the driver task has already exited.
Trait Implementations§
Auto Trait Implementations§
impl !Unpin for Query
impl !UnsafeUnpin for Query
impl Freeze for Query
impl RefUnwindSafe for Query
impl Send for Query
impl Sync for Query
impl UnwindSafe for Query
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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