pub struct CallLedger { /* private fields */ }Expand description
Per-call ledger. Cloneable/inspectable, but the phase can only ever be
advanced one monotonic step at a time through CallLedger::advance_to
(or its named helpers).
Implementations§
Source§impl CallLedger
impl CallLedger
Sourcepub fn plan(call_id: impl Into<String>, effect: ToolEffect) -> CallLedger
pub fn plan(call_id: impl Into<String>, effect: ToolEffect) -> CallLedger
Open a ledger for a freshly PLANNED call.
pub fn call_id(&self) -> &str
pub fn effect(&self) -> ToolEffect
pub fn phase(&self) -> CallPhase
Sourcepub fn advance_to(&mut self, to: CallPhase) -> Result<(), NonMonotonic>
pub fn advance_to(&mut self, to: CallPhase) -> Result<(), NonMonotonic>
Advance to to, which MUST be the immediate successor of the current
phase. Any other target (skip, repeat, or backward) is rejected and
leaves the ledger unchanged.
pub fn start(&mut self) -> Result<(), NonMonotonic>
pub fn commit(&mut self) -> Result<(), NonMonotonic>
pub fn record_result(&mut self) -> Result<(), NonMonotonic>
Sourcepub fn side_effect_possible(&self) -> bool
pub fn side_effect_possible(&self) -> bool
True once the call may have produced a side effect but has not yet
recorded a result: it has STARTED (commit status unknown) or
COMMITTED (side effect definitely occurred), and is not yet
ResultRecorded.
Sourcepub fn on_interrupt(&self) -> InterruptDisposition
pub fn on_interrupt(&self) -> InterruptDisposition
Disposition if the turn is interrupted with this call in its current phase. When no side effect is possible (not started, or already recorded), the interruption is an ordinary cancellation and a rerun is safe. When a side effect is possible, the effect class decides:
NonIdempotent=>InterruptedAfterSideEffect, no auto-rerun;IdempotentWrite/ReadOnly=> plain cancellation, retryable.
Sourcepub fn interrupted_started(
call_id: &str,
effect: ToolEffect,
) -> InterruptDisposition
pub fn interrupted_started( call_id: &str, effect: ToolEffect, ) -> InterruptDisposition
Shared policy for the dispatch paths: the interruption disposition of a call that has STARTED (possible side effect, result not recorded). This keeps the single- and multi-tool dispatch branches using ONE definition of the interrupted-side-effect rule.
Trait Implementations§
Source§impl Clone for CallLedger
impl Clone for CallLedger
Source§fn clone(&self) -> CallLedger
fn clone(&self) -> CallLedger
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CallLedger
impl RefUnwindSafe for CallLedger
impl Send for CallLedger
impl Sync for CallLedger
impl Unpin for CallLedger
impl UnsafeUnpin for CallLedger
impl UnwindSafe for CallLedger
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