Skip to main content

ParseEvent

Enum ParseEvent 

Source
pub enum ParseEvent {
Show 13 variants StreamStart { output_schema_hash: String, }, FieldStart { path: String, field_type: FieldType, }, ValueAppend { path: String, delta: String, }, ValueSet { path: String, value: FieldValue, }, ListOpen { path: String, }, ElementAdded { path: String, index: usize, value: FieldValue, }, ListClose { path: String, value: FieldValue, }, ObjectOpen { path: String, }, EntryAdded { path: String, key: String, value: FieldValue, }, ObjectClose { path: String, value: FieldValue, }, FieldComplete { path: String, value: FieldValue, }, StreamComplete { output: FieldValue, }, StreamError { path: Option<String>, message: String, },
}
Expand description

One event produced by the streaming parser.

Variants are emitted in the order content arrives from the LM. Consumers can rebuild the full structured output from the sequence, OR react to specific events (FieldComplete for “field X is done”, StreamComplete for “everything is done”, ValueAppend for chat-UI typing).

Variants§

§

StreamStart

First event, always. Carries an opaque hash of the output signature so clients can sanity-check they were rendering against the right schema. The full schema is fetched separately via the existing application endpoints (kept out of the stream-start payload to bound the on-open size).

Fields

§output_schema_hash: String
§

FieldStart

A declared output field’s [[ ## name ## ]] marker arrived. Path is /<field_name>; field_type is the declared type for the field so clients know what value-event variants to expect.

Fields

§path: String
§field_type: FieldType
§

ValueAppend

Incremental text content for a FieldType::String field. delta is the new content since the previous event for this path; clients concatenate to render progressively (chat-UI typing). Only emitted for String fields; structured fields use ElementAdded / EntryAdded instead.

Fields

§path: String
§delta: String
§

ValueSet

Atomic value emitted when a non-string scalar finishes parsing (Int, Float, Bool, Enum, Nullable<scalar>). Reserved for future per-FieldType-variant expansion — not emitted by the initial-step parser (which supports String and List<String> only).

Fields

§path: String
§

ListOpen

A FieldType::List field’s content opened — the LM emitted [. Path identifies the field; clients can render an empty list shell before elements arrive.

Fields

§path: String
§

ElementAdded

One element of a FieldType::List finished parsing. index is the element’s position in the list; value is its typed value.

Fields

§path: String
§index: usize
§

ListClose

A FieldType::List field’s content closed — the LM emitted ]. value is the complete parsed list for clients that didn’t accumulate from ElementAdded events.

Fields

§path: String
§

ObjectOpen

A FieldType::Map or FieldType::Object field’s content opened — the LM emitted {. Reserved for future expansion.

Fields

§path: String
§

EntryAdded

One key-value pair of a FieldType::Map / FieldType::Object finished parsing. Reserved for future expansion.

Fields

§path: String
§

ObjectClose

A FieldType::Map / FieldType::Object field’s content closed — the LM emitted }. Reserved for future expansion.

Fields

§path: String
§

FieldComplete

A field’s marker boundary arrived; the prior field is fully done. Carries the full parsed value for clients that didn’t accumulate from per-value events. Always emitted at field- completion, after any ListClose / ObjectClose / ValueAppend events for the field.

Fields

§path: String
§

StreamComplete

The [[ ## completed ## ]] sentinel arrived. output is the full structured output as a FieldValue::Object map of field-name → field-value, mirroring Adapter::parse.

Fields

§output: FieldValue
§

StreamError

Mid-stream parse or deserialization failure. path is the node where the error occurred (may be None for errors between fields). Streaming halts after this event; the consumer returns a non-retryable error.

Fields

§message: String

Implementations§

Source§

impl ParseEvent

Source

pub const fn event_type(&self) -> &'static str

Stable event-type identifier for wire serialization. Mirrors the snake-case identifier the streaming consumer uses when declaring schemas via StreamingEventDef.

Source

pub const fn is_durable(&self) -> bool

Whether this event variant should be durable (WAL-persisted) for late-subscriber replay. Boundary events (start / open / close / complete / error) are durable because they reconstruct the schema’s structure; per-value events (value_append, value_set, element_added, entry_added) are volatile — late subscribers fetch the final structured output via the existing execution endpoint and only need structural events for skeleton rendering.

Trait Implementations§

Source§

impl Clone for ParseEvent

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParseEvent

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ParseEvent

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ParseEvent

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more