How apple/swift-http-structured-headers works
Main Components Structure
a) Public API Layer
• Two distinct modules: StructuredFieldValues (high-level) and RawStructuredFieldValues (low-level)
b) Core Processing Layer
• Parser components
• Serializer components
• Encoder/Decoder components
c) Data Types Layer
• Container types (Dictionary, List, Inner List, Parameters)
• Base item types (Boolean, Integer, Decimal, Token, String, Binary, Date, Display String)
Component Relationships
a) High-Level Flow:
• Client Code → StructuredFieldValues Module → RawStructuredFieldValues Module → Raw Byte Processing
b) Parallel Processing Paths:
• Encoding Path: Codable Types → StructuredFieldValueEncoder → Serializer → Bytes
• Decoding Path: Bytes → Parser → StructuredFieldValueDecoder → Codable Types
Specific Implementation Details
Key components with appropriate connections:
a) StructuredFieldValues Module:
• StructuredFieldValueEncoder
• StructuredFieldValueDecoder
• Keyed/Unkeyed Containers
• Foundation Integration (Date, Data handling)
b) RawStructuredFieldValues Module:
• FieldParser
• FieldSerializer
• ASCII Processing
• Component Types
• Error Handling
Important Notes
Annotations highlighting:
• Foundation dependency for the high-level module
• Standard library-only dependency for the low-level module
• Base64 encoding/decoding requirements
• Type conversion flows