pub trait FormatReader: Send + Sync {
// Required methods
fn descriptor(&self) -> FormatDescriptor;
fn sniff(&self, head: &[u8], path: &Path) -> Option<Detection>;
fn open(&self, path: &Path) -> Result<Box<dyn Dataset>>;
// Provided methods
fn sniff_input(&self, head: &[u8], input: &Input) -> Option<Detection> { ... }
fn open_input(&self, input: &Input) -> Result<Box<dyn Dataset>> { ... }
fn reads_any_source(&self) -> bool { ... }
fn assurance(&self) -> Option<&'static AssuranceProfile> { ... }
}Expand description
A format implementation.
Required Methods§
Sourcefn descriptor(&self) -> FormatDescriptor
fn descriptor(&self) -> FormatDescriptor
Static description of the format (id, name, extensions, known gaps).
Provided Methods§
Sourcefn open_input(&self, input: &Input) -> Result<Box<dyn Dataset>>
fn open_input(&self, input: &Input) -> Result<Box<dyn Dataset>>
Open an Input: a local path, a buffer in memory, or a source the host provides.
Readers that read through Input::fs override it (and make open a thin wrapper);
the default opens local inputs by path and reports every other source as unsupported
(exit 6), so a reader that does not read through byte sources never touches the local disk
for a buffer that merely has the same name.
Sourcefn reads_any_source(&self) -> bool
fn reads_any_source(&self) -> bool
True when open_input reads any Input (memory, host
callbacks), not only local paths.
Sourcefn assurance(&self) -> Option<&'static AssuranceProfile>
fn assurance(&self) -> Option<&'static AssuranceProfile>
The reader’s assurance profile (its crate’s src/assurance.rs): how to fingerprint a
file’s variant and which variants the development corpus validates. None (the
default) makes every file of the format unvalidated.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".