pub trait Format {
// Required methods
fn import<R: Read>(&self, reader: R) -> Result<Narrative>;
fn export<W: Write>(&self, narrative: &Narrative, writer: W) -> Result<()>;
// Provided methods
fn import_str(&self, data: &str) -> Result<Narrative> { ... }
fn export_str(&self, narrative: &Narrative) -> Result<String> { ... }
}Expand description
Trait for formats that can import and export narratives.
This trait defines a common interface for reading and writing narratives in various formats (GeoJSON, CSV, etc.).
Required Methods§
Provided Methods§
Sourcefn import_str(&self, data: &str) -> Result<Narrative>
fn import_str(&self, data: &str) -> Result<Narrative>
Import a narrative from a string.
This is a convenience method that wraps the string in a reader.
Sourcefn export_str(&self, narrative: &Narrative) -> Result<String>
fn export_str(&self, narrative: &Narrative) -> Result<String>
Export a narrative to a string.
This is a convenience method that collects output into a String.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.