pub struct VerificationDeadline { /* private fields */ }Expand description
Enforces a strict bounded deadline for verification tasks.
Implementations§
Source§impl VerificationDeadline
impl VerificationDeadline
Sourcepub fn new(timeout: Duration) -> Self
pub fn new(timeout: Duration) -> Self
Create a new verification deadline from the given timeout duration.
Sourcepub fn for_attempts(
per_attempt_timeout: Duration,
max_attempts: usize,
max_backoff: Duration,
) -> Self
pub fn for_attempts( per_attempt_timeout: Duration, max_attempts: usize, max_backoff: Duration, ) -> Self
Create a bounded deadline for a multi-attempt task, accounting for per-attempt timeouts and retry backoff.
Sourcepub fn remaining(&self) -> Result<Duration, VerificationResult>
pub fn remaining(&self) -> Result<Duration, VerificationResult>
Return the remaining duration before the deadline expires.
Fails closed with [TIMEOUT_ERROR] if the deadline has already passed.
Sourcepub fn check(&self) -> Result<(), VerificationResult>
pub fn check(&self) -> Result<(), VerificationResult>
Check whether the deadline has passed, returning an error if expired.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Returns true if the deadline has elapsed.
Sourcepub async fn run_bounded<F, T>(&self, fut: F) -> Result<T, VerificationResult>where
F: Future<Output = T>,
pub async fn run_bounded<F, T>(&self, fut: F) -> Result<T, VerificationResult>where
F: Future<Output = T>,
Execute a future bounded strictly by the remaining deadline.
Trait Implementations§
Source§impl Clone for VerificationDeadline
impl Clone for VerificationDeadline
Source§fn clone(&self) -> VerificationDeadline
fn clone(&self) -> VerificationDeadline
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for VerificationDeadline
Auto Trait Implementations§
impl Freeze for VerificationDeadline
impl RefUnwindSafe for VerificationDeadline
impl Send for VerificationDeadline
impl Sync for VerificationDeadline
impl Unpin for VerificationDeadline
impl UnsafeUnpin for VerificationDeadline
impl UnwindSafe for VerificationDeadline
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
Mutably borrows from an owned value. Read more
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> 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> ⓘ
Converts
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> ⓘ
Converts
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