Skip to main content

wrap_stream

Function wrap_stream 

Source
pub fn wrap_stream<T: Serialize + Send + 'static>(
    stream: impl Stream<Item = T> + Send + 'static,
    content_type: &'static str,
    provenance: Vec<String>,
) -> PlexusStream
Expand description

Wrap a typed stream into PlexusStream with automatic Done event

This is the core helper for the caller-wraps architecture. Activations return typed domain events (e.g., HealthEvent), and the caller wraps them with metadata. A Done event is automatically appended when the stream completes.

§Example

let stream = health.check();  // Returns Stream<Item = HealthEvent>
let wrapped = wrap_stream(stream, "health.status", vec!["health".into()]);
// Stream will emit: Data, Data, ..., Done