pub struct ProgressHandle { /* private fields */ }Expand description
A handle for polling the progress of a long-running query.
A Connection is not Sync, so the thread running the query owns it for
the duration. This handle is Send + Sync, cheap to clone, and does not
block the query.
Once the connection is closed or dropped, ProgressHandle::query_progress
reports an unavailable snapshot rather than failing, matching how
crate::InterruptHandle becomes a no-op. That makes a closed connection
indistinguishable from a query DuckDB cannot estimate, so a poller deciding
whether to keep polling should ask ProgressHandle::is_connected.
See the module docs for an example.
Implementations§
Source§impl ProgressHandle
impl ProgressHandle
Sourcepub fn query_progress(&self) -> QueryProgress
pub fn query_progress(&self) -> QueryProgress
Snapshot the progress of the query running on the connection this handle came from.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Whether the connection this handle came from is still open.
Distinguishes a closed connection from a query with no estimate, since
ProgressHandle::query_progress reports both as unavailable. This is
a hint, not a guarantee: the connection may close immediately after it
returns true.
Trait Implementations§
Source§impl Clone for ProgressHandle
impl Clone for ProgressHandle
Auto Trait Implementations§
impl Freeze for ProgressHandle
impl RefUnwindSafe for ProgressHandle
impl Send for ProgressHandle
impl Sync for ProgressHandle
impl Unpin for ProgressHandle
impl UnsafeUnpin for ProgressHandle
impl UnwindSafe for ProgressHandle
Blanket Implementations§
impl<T> Allocation for T
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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