pub struct CallControl { /* private fields */ }Expand description
One tool call’s control plane: the same turn-shared CancellationToken
with the deadline narrowed to the call.
Implementations§
Source§impl CallControl
impl CallControl
Sourcepub fn new(
cancellation: CancellationToken,
call_timeout: Option<Duration>,
) -> Self
pub fn new( cancellation: CancellationToken, call_timeout: Option<Duration>, ) -> Self
Build a CallControl from a cancellation token and an optional
duration-based deadline. Prefer AttemptControl::for_call, which
folds the parent attempt deadline in; this constructor is for tests
and callers that cannot go through it.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether the turn’s cancellation has fired.
Sourcepub fn cancellation_token(&self) -> &CancellationToken
pub fn cancellation_token(&self) -> &CancellationToken
The turn-shared primitive — race it against in-flight tool work instead of polling.
Sourcepub fn check(&self) -> Result<(), ControlError>
pub fn check(&self) -> Result<(), ControlError>
Sync guard for tool loops: Err when the turn is cancelled or the
effective deadline has passed.
Trait Implementations§
Source§impl Clone for CallControl
impl Clone for CallControl
Source§fn clone(&self) -> CallControl
fn clone(&self) -> CallControl
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 CallControl
impl RefUnwindSafe for CallControl
impl Send for CallControl
impl Sync for CallControl
impl Unpin for CallControl
impl UnsafeUnpin for CallControl
impl UnwindSafe for CallControl
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