pub struct RunControl { /* private fields */ }Expand description
Shared cancellation and an optional absolute execution deadline.
Implementations§
Source§impl RunControl
impl RunControl
Sourcepub fn new(cancellation: CancellationToken, deadline: Option<Instant>) -> Self
pub fn new(cancellation: CancellationToken, deadline: Option<Instant>) -> Self
Combine a caller-owned cancellation token and absolute deadline.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether cancellation has been requested.
Sourcepub fn cancellation_token(&self) -> &CancellationToken
pub fn cancellation_token(&self) -> &CancellationToken
The caller-owned cancellation token.
Sourcepub fn should_stop(&self) -> bool
pub fn should_stop(&self) -> bool
Whether cancellation or the absolute deadline requires stopping.
Sourcepub fn call_control(&self) -> CallControl
pub fn call_control(&self) -> CallControl
Inherit the exact token and deadline without starting a local timeout.
Sourcepub fn remaining_turn_time(&self) -> Option<Duration>
pub fn remaining_turn_time(&self) -> Option<Duration>
Remaining execution time, saturating at zero.
Trait Implementations§
Source§impl Clone for RunControl
impl Clone for RunControl
Auto Trait Implementations§
impl Freeze for RunControl
impl RefUnwindSafe for RunControl
impl Send for RunControl
impl Sync for RunControl
impl Unpin for RunControl
impl UnsafeUnpin for RunControl
impl UnwindSafe for RunControl
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