longhuanlin/multipart-stream/form does not have a README file

    FormError

    pub(all) suberror FormError {
    InvalidCollectorLimits(reason~ : String)
    UnexpectedEvent(reason~ : String)
    FilePartRejected(part_index~ : Int)
    FieldLimitExceeded(limit~ : Int64, observed~ : Int64)
    FieldCountExceeded(limit~ : Int, observed~ : Int)
    InvalidTextEncoding(field_name~ : String, charset~ : String)
    SinkFailed(reason~ : String)
    SourceFailed(reason~ : String)
    Protocol(error~ :
    MultipartError
    )
    } derive(Eq,
    Debug
    )

    Failures at the collector and transport-adapter boundary.

    ChunkSourceAdapter

    pub struct ChunkSourceAdapter {
    next_chunk : () -> Result[Bytes?, FormError]
    }

    A transport-neutral source of already-owned body chunks. Native async and framework adapters can wrap their own readers behind this callback without changing the all-target core parser.

    ChunkSourceAdapter::new

    fn ChunkSourceAdapter::new(next_chunk : () -> Result[Bytes?, FormError]) -> ChunkSourceAdapter

    DecodedField

    pub(all) struct DecodedField {
    name : String
    value : String
    content_type : String?
    } derive(Eq,
    Debug
    )

    A decoded text field. Decoding is explicit so binary field consumers can continue using FormField.value without an implicit UTF-8 conversion.

    FieldCollector

    pub struct FieldCollector {
    limits : FieldCollectorLimits
    fields : Array[FormField]
    active_meta :
    PartMeta
    ?
    body :
    Buffer

    total_field_bytes : Int64
    message_ended : Bool
    }

    FieldCollector::consume

    Consume parser events without buffering file parts.

    FieldCollector::decoded_fields

    fn FieldCollector::decoded_fields(self : FieldCollector, default_charset? : String) -> Array[DecodedField] raise FormError

    Decode collected fields using an explicit default or a _charset_ field. Only UTF-8 and US-ASCII are accepted by the strict decoding policy.

    FieldCollector::finish

    Return an owned snapshot after the parser has emitted MessageEnd.

    FieldCollector::new

    FieldCollectorLimits

    pub(all) struct FieldCollectorLimits {
    max_fields : Int
    max_field_bytes : Int64
    max_total_field_bytes : Int64
    } derive(Eq,
    Debug
    )

    Limits for in-memory form fields. File bodies are never accepted by the collector; route them through PartSinkAdapter instead.

    FormField

    pub(all) struct FormField {
    meta :
    PartMeta

    value : Bytes
    } derive(Eq,
    Debug
    )

    A completed small text or binary form field.

    PartSinkAdapter

    pub struct PartSinkAdapter {
    on_begin : (
    PartMeta
    ) -> Result[Unit, FormError]
    on_data : (Bytes) -> Result[Unit, FormError]
    on_end : (Int) -> Result[Unit, FormError]
    on_message_end : () -> Result[Unit, FormError]
    }

    Callback-based file/part sink. The callbacks receive parser-owned event data immediately; applications can write file bytes without using the in-memory FieldCollector.

    PartSinkAdapter::new

    fn PartSinkAdapter::new(on_begin : (
    PartMeta
    ) -> Result[Unit, FormError], on_data : (Bytes) -> Result[Unit, FormError], on_end : (Int) -> Result[Unit, FormError], on_message_end : () -> Result[Unit, FormError]) -> PartSinkAdapter

    default_field_collector_limits

    fn default_field_collector_limits() -> FieldCollectorLimits

    drive_events

    Deliver events to a caller-supplied sink in protocol order.

    parse_from_source

    Drive a parser until the source returns None, then require finish().