pub struct TraceContext<'a> { /* private fields */ }Expand description
Everything checks need, precomputed once per trace.
Implementations§
Source§impl<'a> TraceContext<'a>
impl<'a> TraceContext<'a>
Sourcepub fn exchanges(&self) -> impl Iterator<Item = Exchange<'a>> + '_
pub fn exchanges(&self) -> impl Iterator<Item = Exchange<'a>> + '_
Iterates completed request/response exchanges, in response order.
Sourcepub fn exchanges_for(
&self,
method: &'a str,
) -> impl Iterator<Item = Exchange<'a>> + '_
pub fn exchanges_for( &self, method: &'a str, ) -> impl Iterator<Item = Exchange<'a>> + '_
Completed exchanges for one request method — the shape feature-area checks
want: “every tools/list result MUST …”.
Source§impl<'a> TraceContext<'a>
impl<'a> TraceContext<'a>
Sourcepub fn new(events: &'a [TraceEvent]) -> Self
pub fn new(events: &'a [TraceEvent]) -> Self
Builds the context in one pass over the events.
§Panics
When seq is not strictly increasing across events. The trace
schema requires it, reader::parse_trace rejects documents that
violate it, and several checks compare seq values across events on
the premise that no two events share one — a hand-built slice that
breaks the premise would otherwise be judged silently wrong, not
loudly invalid.
Sourcepub const fn events(&self) -> &'a [TraceEvent]
pub const fn events(&self) -> &'a [TraceEvent]
The underlying events.
Sourcepub fn messages(
&self,
) -> impl Iterator<Item = (&'a TraceEvent, &MessageKind<'a>, Phase)> + '_
pub fn messages( &self, ) -> impl Iterator<Item = (&'a TraceEvent, &MessageKind<'a>, Phase)> + '_
Iterates (event, classification, phase-before-event) triples for message
events only — the shape almost every check wants.
Sourcepub const fn initialize(&self) -> &InitializeExchange<'a>
pub const fn initialize(&self) -> &InitializeExchange<'a>
The observed initialize exchange.
Sourcepub fn server_capabilities(&self) -> Option<&'a Value>
pub fn server_capabilities(&self) -> Option<&'a Value>
The server’s declared capabilities, from the initialize result.
Sourcepub fn client_capabilities(&self) -> Option<&'a Value>
pub fn client_capabilities(&self) -> Option<&'a Value>
The client’s declared capabilities, from the initialize request params.
Sourcepub const fn final_phase(&self) -> Phase
pub const fn final_phase(&self) -> Phase
The lifecycle phase after the entire trace has been processed.