pub struct TurnCompletion { /* private fields */ }Expand description
Per-turn signals shared by the host and the engine.
Engine → host: whether the turn reached its NORMAL end — the final
response came back un-cancelled and asked for no tools (nothing left to
do). Set before the engine publishes that turn’s final MessageHistory.
Done cannot say this: several cancelled paths also end Ok + Done.
A host that cancels a turn reads it once the stream is drained: a turn
that finished just before the cancel reached it (Esc a moment too late)
is complete, not interrupted.
Host → engine: WHY the host cancelled the turn, noted before it cancels
the token, so a canceled tool_result says so (“Canceled by user” only
when it was the user). Nothing noted = the turn’s default cause: the
user (the historical wording), or what the host chose at turn start
(with_default_cause: a driver turn whose token something else cancels,
e.g. the grant’s deadline, was cut by the driver ending).
Implementations§
Source§impl TurnCompletion
impl TurnCompletion
pub fn new() -> TurnCompletion
Sourcepub fn with_default_cause(cause: CancelCause) -> TurnCompletion
pub fn with_default_cause(cause: CancelCause) -> TurnCompletion
A turn whose un-noted cancels are cause’s (see the type docs).
pub fn completed(&self) -> bool
Sourcepub fn note_cancel_cause(&self, cause: CancelCause)
pub fn note_cancel_cause(&self, cause: CancelCause)
Note why the host is cancelling this turn. First cause wins: a teardown that revokes a driver and then cancels keeps its own cause.
Trait Implementations§
Source§impl Clone for TurnCompletion
impl Clone for TurnCompletion
Source§fn clone(&self) -> TurnCompletion
fn clone(&self) -> TurnCompletion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TurnCompletion
impl Debug for TurnCompletion
Source§impl Default for TurnCompletion
impl Default for TurnCompletion
Source§fn default() -> TurnCompletion
fn default() -> TurnCompletion
Auto Trait Implementations§
impl Freeze for TurnCompletion
impl RefUnwindSafe for TurnCompletion
impl Send for TurnCompletion
impl Sync for TurnCompletion
impl Unpin for TurnCompletion
impl UnsafeUnpin for TurnCompletion
impl UnwindSafe for TurnCompletion
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> ⓘ
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> ⓘ
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