folk-api 0.2.8

Plugin contract for the Folk PHP application server
Documentation
use std::collections::HashMap;

use bytes::Bytes;

/// A chunk in a streaming response from a PHP worker.
///
/// The worker emits a sequence ending with [`End`]. Consumers read until `End`
/// (or the channel closes) to obtain the complete response.
///
/// [`End`]: ResponseChunk::End
#[derive(Debug, Clone)]
pub enum ResponseChunk {
    /// Response status and headers. Must be the first chunk (after optional EarlyHints).
    Headers {
        status: u16,
        headers: HashMap<String, String>,
    },
    /// A piece of the response body.
    Body(Bytes),
    /// Signals that the response is complete.
    End,
}