Skip to main content

event_stream_response_body

Function event_stream_response_body 

Source
pub fn event_stream_response_body<T, E>(
    output_schema: &Schema<'_>,
    output: &dyn SerializableStruct,
    events: EventStreamSender<T, E>,
    marshaller: impl MarshallMessage<Input = T> + Send + Sync + 'static,
    error_marshaller: impl MarshallMessage<Input = E> + Send + Sync + 'static,
    protocol: &SharedServerProtocol,
    initial_response: InitialResponsePolicy,
) -> Result<BoxBody, SerdeError>
where T: Send + Sync + 'static, E: Error + Send + Sync + 'static,
Expand description

Builds the response body of an event stream output: the marshalled events, preceded by an initial-response frame when initial_response is InitialResponsePolicy::Send.

Protocols that carry non-stream members in initial messages serialize those members into the frame. HTTP-bound protocols use their unset payload instead, matching generated serde servers.

output_schema and output describe the non-stream members; the streaming member must already have been moved out of output into events.