- Correctness: do no deviate from the RFC, support edge and obsolete cases
- Straightforward/maintainable: implement the RFCs as close as possible, minimizing the amount of clever tricks and optimizations
- Multiple syntax: Write the parser so it's easy to alternate between the strict and obsolete/compatible syntax
- Never fail: Provide as many fallbacks as possible
## Non goals
- Parsing optimization (greedy parser, etc.) as it would require to significantly deviate from the RFC ABNF syntax (would consider this case if we could prove that the transformation we make are equivalent)
- Pipelining/streaming/buffering as the parser can arbitrarily backtrack + our result contains reference to the whole buffer, imf-codec must keep the whole buffer in memory. Avoiding the sequential approach would certainly speed-up a little bit the parsing, but it's too much work to implement currently.
- Zerocopy. It might be implementable in the future, but to quickly bootstrap this project, I avoided it for now.
## Missing / known bugs
Current known limitations/bugs:
- Resent Header Fields are not implemented
- Return-Path/Received headers might be hard to use as their order is important, and it's currently lost in the final datastructure.
- Datetime parsing of invalid date might return `None` instead of falling back to the `bad_body` field