Skip to main content

create_streaming_response

Function create_streaming_response 

Source
pub fn create_streaming_response<S>(
    stream: S,
    format: StreamFormat,
) -> Result<Response, StreamTransportError>
where S: Stream<Item = Result<Vec<u8>, StreamTransportError>> + Send + 'static,
Expand description

Create a response with appropriate headers for the given streaming format.

The stream item type is Vec<u8> (binary). This is the canonical type for both UTF-8 textual formats (Json, NdJson, ServerSentEvents) and binary payloads (Binary, e.g. gzip-compressed output).