Skip to main content

StreamBlock

Struct StreamBlock 

Source
pub struct StreamBlock {
    pub chunk_type: String,
    pub on_chunk: Option<StepNode>,
    pub on_complete: Option<StepNode>,
    pub on_error: Option<StepNode>,
    pub body: Vec<FlowStep>,
    pub loc: Loc,
}
Expand description

v1.29.0 / v2.67.0 / v2.83.0stream<T> { on_chunk … on_complete … }.

The body used to NOT EXIST. parse_block_step — shared with deliberate, consensus and (pre-retraction) transact — called skip_braced_block() and threw the block’s contents away at PARSE time. The handler was not a no-op because someone forgot to implement it; it was a no-op because the body never reached the AST for anything to execute. Four advertised primitives died in that one function.

v2.83.0 — and v2.67.0 closed that with the WRONG SHAPE. It gave the block a body: Vec<FlowStep>, which no published block and no paper writes. The specified surface — the design plan section 3.7, whose D8 promises “backward compat for stream<τ> 100%, cero cambios en .axon source files de adopters” — is stream<T> { on_chunk: B₁ on_complete: B₂ }, and README block 15 publishes exactly that. Measured before this landed:

  • at FLOW level the published body was a hard parse error (Unexpected token in flow body: 'on_chunk');
  • in a STEP body the whole block was silently discarded by skip_flow_step_structural, so block 15’s step Stream reached the dispatcher with pix_ops=0, ask="", output="" — an EMPTY step, whose Stream.output the next step then reasoned over.

So v2.67.0’s attestation was the v2.83.0 reason defect one more time: a real engine behind a grammar no adopter could write. body is KEPT (it parses, it lowers, it runs, and removing it would break any program written against v2.67.0), but it is no longer the primitive’s published face.

Fields§

§chunk_type: String

The <T> in stream<T> — the CHUNK type. Empty when the block is written without one.

It used to be discarded silently: parse_stream_block’s “tolerate the pre-111 form” loop advanced to the first {, eating <QuoteData> on the way. A type parameter consumed by nothing is the v2.67.0 defect, so it is captured here and type-checked at the handler boundary.

§on_chunk: Option<StepNode>

on_chunk: { … } — run ONCE PER CHUNK, with the chunk bound under chunk. None when the handler is absent.

It is a StepNode, not a Vec<FlowStep>, because the published arm body is a STEP body and not a flow body: block 15 writes on_chunk: { probe chunk for […] output: QuoteSnapshot }, and output: is a step field that has no flow-level position at all. Sharing the shape means the arm reuses run_step — the design decision’s “one concept, two positions”, so there is no second dispatch implementation to drift.

§on_complete: Option<StepNode>

on_complete: { … } — run ONCE, after the source closes, with the accumulated stream bound under complete. None when absent.

§on_error: Option<StepNode>

v2.83.0 — on_error: { … } — run when the SOURCE fails, with the failure bound under error.

It handles a failure of the producer, never a failure of the author’s own handlers. If on_chunk panics its way to a dispatch error, that is a bug in the program, and routing it here would let a broken handler silently catch itself and report the stream as healthy. Cancellation is not a failure either — a cancelled stream propagates as cancelled.

When present and the source fails, the step COMPLETES with this arm’s output: the author declared what to do, so the recovery is explicit rather than a swallowed error. When absent, the failure propagates.

§body: Vec<FlowStep>

v2.67.0’s body form: stream { <steps> }. Executed in order; each one’s fragments are emitted on the flow’s event channel as produced. Retained for compatibility — see the type-level note above.

§loc: Loc

Trait Implementations§

Source§

impl Debug for StreamBlock

Source§

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

Formats the value using the given formatter. Read more

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<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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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