pub trait FormatParser: Send + Sync {
// Required methods
fn id(&self) -> &'static str;
fn extensions(&self) -> &'static [&'static str];
fn sniff(&self, bytes: &[u8]) -> Option<Confidence>;
fn parse(&self, source: &str, bytes: &[u8]) -> Result<Vec<Column>, AxError>;
}Expand description
One file format. Implementors live in parsers/ — one per format.
Required Methods§
Sourcefn id(&self) -> &'static str
fn id(&self) -> &'static str
Stable identifier, recorded in the envelope’s format field (e.g. "csv").
Sourcefn extensions(&self) -> &'static [&'static str]
fn extensions(&self) -> &'static [&'static str]
File extensions this parser claims (lower-case, no dot).
Sourcefn sniff(&self, bytes: &[u8]) -> Option<Confidence>
fn sniff(&self, bytes: &[u8]) -> Option<Confidence>
How strongly bytes looks like this format, or None if it clearly is
not. Used only when the extension doesn’t decide.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".