Skip to main content

TraceContext

Struct TraceContext 

Source
pub struct TraceContext<'a> { /* private fields */ }
Expand description

Everything checks need, precomputed once per trace.

Implementations§

Source§

impl<'a> TraceContext<'a>

Source

pub fn exchanges(&self) -> impl Iterator<Item = Exchange<'a>> + '_

Iterates completed request/response exchanges, in response order.

Source

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>

Source

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.

Source

pub const fn events(&self) -> &'a [TraceEvent]

The underlying events.

Source

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.

Source

pub const fn initialize(&self) -> &InitializeExchange<'a>

The observed initialize exchange.

Source

pub fn server_capabilities(&self) -> Option<&'a Value>

The server’s declared capabilities, from the initialize result.

Source

pub fn client_capabilities(&self) -> Option<&'a Value>

The client’s declared capabilities, from the initialize request params.

Source

pub const fn final_phase(&self) -> Phase

The lifecycle phase after the entire trace has been processed.

Trait Implementations§

Source§

impl<'a> Debug for TraceContext<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for TraceContext<'a>

§

impl<'a> RefUnwindSafe for TraceContext<'a>

§

impl<'a> Send for TraceContext<'a>

§

impl<'a> Sync for TraceContext<'a>

§

impl<'a> Unpin for TraceContext<'a>

§

impl<'a> UnsafeUnpin for TraceContext<'a>

§

impl<'a> UnwindSafe for TraceContext<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.