Skip to main content

folk_api/
response.rs

1use std::collections::HashMap;
2
3use bytes::Bytes;
4
5/// A chunk in a streaming response from a PHP worker.
6///
7/// The worker emits a sequence ending with [`End`]. Consumers read until `End`
8/// (or the channel closes) to obtain the complete response.
9///
10/// [`End`]: ResponseChunk::End
11#[derive(Debug, Clone)]
12pub enum ResponseChunk {
13    /// Response status and headers. Must be the first chunk (after optional EarlyHints).
14    Headers {
15        status: u16,
16        headers: HashMap<String, String>,
17    },
18    /// A piece of the response body.
19    Body(Bytes),
20    /// Signals that the response is complete.
21    End,
22}