pub struct SpanLog { /* private fields */ }Expand description
A bounded, in-order log of tool spans, built by pairing a harness’s “call started” and “call finished” records by call id.
Records arrive interleaved and out of order (agents run tools in parallel), so a span is closed by searching back for the still-open span with that id rather than assuming the most recent one.
Implementations§
Source§impl SpanLog
impl SpanLog
Sourcepub fn open(
&mut self,
id: String,
name: String,
at: SystemTime,
sidechain: bool,
)
pub fn open( &mut self, id: String, name: String, at: SystemTime, sidechain: bool, )
Record the start of a call. Ignored when that id is already open, so a transcript line replayed by the harness does not double-count.
Sourcepub fn close(&mut self, id: &str, at: SystemTime, error: bool)
pub fn close(&mut self, id: &str, at: SystemTime, error: bool)
Close the open call with this id. A result whose call scrolled out of the window, or that we never saw start, is dropped.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn to_vec(&self) -> Vec<ToolSpan>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SpanLog
impl RefUnwindSafe for SpanLog
impl Send for SpanLog
impl Sync for SpanLog
impl Unpin for SpanLog
impl UnsafeUnpin for SpanLog
impl UnwindSafe for SpanLog
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