pub struct CallControl { /* private fields */ }Expand description
Cooperative control for a logical model invocation, preparation or tool work.
Implementations§
Source§impl CallControl
impl CallControl
Sourcepub fn new(cancellation: CancellationToken, deadline: Option<Instant>) -> Self
pub fn new(cancellation: CancellationToken, deadline: Option<Instant>) -> Self
Builds control from a cancellation token and an absolute deadline.
Sourcepub fn with_timeout(&self, timeout: Duration) -> Self
pub fn with_timeout(&self, timeout: Duration) -> Self
Inherits cancellation and narrows the deadline by a local timeout.
The local clock starts now. An unrepresentably distant timeout adds no earlier constraint, and this operation never cancels the parent token.
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
Auto 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