pub struct RunControl { /* private fields */ }Expand description
Turn-level run control: the shared cancellation token plus the turn
deadline. The driver checks RunControl::should_stop at every loop
top; attempts and tool calls get narrowed views via
RunControl::for_attempt.
Implementations§
Source§impl RunControl
impl RunControl
Sourcepub fn new(
cancellation: CancellationToken,
turn_deadline: Option<Instant>,
) -> Self
pub fn new( cancellation: CancellationToken, turn_deadline: Option<Instant>, ) -> Self
Bundle the shared cancellation token with an optional turn deadline.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether the shared cancellation token has fired.
Sourcepub fn should_stop(&self) -> bool
pub fn should_stop(&self) -> bool
True when the turn is cancelled or the turn deadline has passed — the driver checks this at every loop top.
Sourcepub fn for_attempt(&self, attempt_timeout: Option<Duration>) -> AttemptControl
pub fn for_attempt(&self, attempt_timeout: Option<Duration>) -> AttemptControl
Narrow the turn-level control into an attempt-scoped one: the shared token plus the attempt deadline (earlier of turn deadline and attempt timeout).
Sourcepub fn remaining_turn_time(&self) -> Option<Duration>
pub fn remaining_turn_time(&self) -> Option<Duration>
Time left until the turn deadline, Some(0) once it has passed —
for driver-owned waits (retry backoff) that must not outlive the
turn.
Trait Implementations§
Source§impl Clone for RunControl
impl Clone for RunControl
Source§fn clone(&self) -> RunControl
fn clone(&self) -> RunControl
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 moreAuto 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