Expand description
The format-parser plugin contract.
Each file format is an independent FormatParser (one per file under
parsers/). A ParserRegistry resolves a byte stream to a parser — by
file extension first, then by content sniff — and asks it to produce
columns. Adding a format is: write a parsers/<fmt>.rs, implement the trait,
and register it in [parsers::default_registry]. No central match to edit.
This mirrors the Detector/Registry pattern in ax-detect: explicit
registration (so formats are feature-gateable and the set is deterministic),
not runtime dynamic loading.
Structs§
- Parser
Registry - An ordered set of format parsers.
Constants§
- FALLBACK
- Last-resort claim — CSV treats any leftover text as comma-delimited.
- MAGIC
- A binary magic number matched (e.g. Parquet
PAR1). Unambiguous. - STRONG
- A distinctive text shape that should win over the generic fallback (e.g. NDJSON’s repeated object-per-line).
- TEXT
- A recognizable text shape (single JSON document, tab-delimited).
Traits§
- Format
Parser - One file format. Implementors live in
parsers/— one per format.
Type Aliases§
- Confidence
- Content-sniff confidence. Higher wins; ties break by registration order, so resolution is deterministic. Use the named constants rather than bare ints.