pub struct TimeoutContext { /* private fields */ }Expand description
Lightweight timeout context for query execution.
This struct captures the timeout configuration from SelectExecutor and can
be passed to functions that need to check for timeouts but don’t need the
full executor reference.
Implementations§
Source§impl TimeoutContext
impl TimeoutContext
Sourcepub fn new(start_time: Instant, timeout_seconds: u64) -> Self
pub fn new(start_time: Instant, timeout_seconds: u64) -> Self
Create a new timeout context with the given start time and timeout.
Sourcepub fn from_executor(executor: &SelectExecutor<'_>) -> Self
pub fn from_executor(executor: &SelectExecutor<'_>) -> Self
Create a timeout context from a SelectExecutor.
Sourcepub fn new_default() -> Self
pub fn new_default() -> Self
Create a default timeout context (for use when no executor is available).
This creates a context with the current time as start and default timeout.
Use sparingly - prefer from_executor when an executor is available.
Sourcepub fn check(&self) -> Result<(), ExecutorError>
pub fn check(&self) -> Result<(), ExecutorError>
Check if the timeout has been exceeded.
Returns Ok(()) if within timeout, Err(QueryTimeoutExceeded) if exceeded.
Call this periodically in hot loops (every CHECK_INTERVAL iterations).
Sourcepub fn start_time(&self) -> Instant
pub fn start_time(&self) -> Instant
Get the start time for this timeout context.
Sourcepub fn timeout_seconds(&self) -> u64
pub fn timeout_seconds(&self) -> u64
Get the timeout in seconds for this timeout context.
Trait Implementations§
Source§impl Clone for TimeoutContext
impl Clone for TimeoutContext
Source§fn clone(&self) -> TimeoutContext
fn clone(&self) -> TimeoutContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for TimeoutContext
impl Default for TimeoutContext
impl Copy for TimeoutContext
Auto Trait Implementations§
impl Freeze for TimeoutContext
impl RefUnwindSafe for TimeoutContext
impl Send for TimeoutContext
impl Sync for TimeoutContext
impl Unpin for TimeoutContext
impl UnwindSafe for TimeoutContext
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> 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