Skip to main content

Module stream_runtime

Module stream_runtime 

Source
Expand description

Runtime implementation of Stream<T> with the four closed backpressure policies from crate::stream_effect.

§λ-L-E Fase 11.a — Temporal Algebraic Effects.

A Stream<T> is a bounded async channel with an explicit backpressure handler. Every producer push goes through the policy: the policy is not a fallback but the primary control point, which is why the compiler makes it mandatory.

Naming is intentionally generic. The existing crate::runtime tree keeps LLM-token streaming (§semantic streaming with epistemic gradient) separate — that’s higher-level, cognitive. Stream<T> is the byte/frame/event-level primitive that websocket ingress, microphone taps, and file uploads land into.

Structs§

Stream
Bounded async stream with a declared backpressure policy. Clone-able handle — producer and consumer hold the same Arc.
StreamMetrics
StreamMetricsSnapshot

Enums§

StreamError
Error surfaced to a producer whose push was dropped by [Fail] or which timed out waiting for [PauseUpstream]. Also the error a consumer sees when the stream was cancelled.

Type Aliases§

DegradationFn
Pure (effect-free) degradation function the runtime applies when the BackpressurePolicy::DegradeQuality policy fires. The function MUST be deterministic — the checker rejects impure degraders at compile time.