pub struct CancelHandle(/* private fields */);Expand description
Cancels the request in flight on a Client’s connection from outside the
future awaiting it: another task, or a select! branch beside it.
Unlike Client::cancel_query, which can only run once the response
stream has been dropped, this also stops a request that is still being sent
or that the server hasn’t answered yet, such as a statement still sorting,
aggregating or waiting on a lock.
Implementations§
Source§impl CancelHandle
impl CancelHandle
Sourcepub fn cancel(&self)
pub fn cancel(&self)
Asks the server to stop the request in flight on the connection.
The Attention goes out the next time the response is read, so keep polling the future awaiting it. It then finishes early, with whatever the server sent before it stopped, or with server error 3980 if the request was aborted before it ran.
A cancel is forgotten if it comes before a request is sent, so it never
stops a later one, or if the response is dropped before the Attention
goes out; call Client::cancel_query then instead.