Expand description
Streaming response types for RustAPI
This module provides types for streaming response bodies.
§Example
ⓘ
use rustapi_core::stream::StreamBody;
use futures_util::stream;
use bytes::Bytes;
async fn stream_data() -> StreamBody<impl Stream<Item = Result<Bytes, std::convert::Infallible>>> {
let stream = stream::iter(vec![
Ok(Bytes::from("chunk 1")),
Ok(Bytes::from("chunk 2")),
]);
StreamBody::new(stream)
}Structs§
- Stream
Body - A streaming body wrapper for HTTP responses
Functions§
- stream_
from_ iter - Helper function to create a streaming body from an iterator of byte chunks
- stream_
from_ strings - Helper function to create a streaming body from a string iterator