pub struct CsvFormat {
pub options: CsvOptions,
}Expand description
CSV format handler.
This format handler can import and export narratives in CSV format. The CSV must have latitude, longitude, and timestamp columns at minimum.
§Example
use spatial_narrative::io::{CsvFormat, Format};
let format = CsvFormat::default();
let csv_data = "lat,lon,timestamp,text\n\
40.7128,-74.006,2024-01-15T14:30:00Z,Something happened\n\
34.0522,-118.2437,2024-01-16T10:00:00Z,Another event";
let narrative = format.import_str(csv_data).unwrap();
assert_eq!(narrative.events().len(), 2);Fields§
§options: CsvOptionsConfiguration options for CSV import/export
Implementations§
Source§impl CsvFormat
impl CsvFormat
Sourcepub fn with_options(options: CsvOptions) -> Self
pub fn with_options(options: CsvOptions) -> Self
Create a new CSV format handler with custom options.
Trait Implementations§
Source§impl Format for CsvFormat
impl Format for CsvFormat
Source§fn import<R: Read>(&self, reader: R) -> Result<Narrative>
fn import<R: Read>(&self, reader: R) -> Result<Narrative>
Import a narrative from a reader. Read more
Source§fn export<W: Write>(&self, narrative: &Narrative, writer: W) -> Result<()>
fn export<W: Write>(&self, narrative: &Narrative, writer: W) -> Result<()>
Export a narrative to a writer. Read more
Auto Trait Implementations§
impl Freeze for CsvFormat
impl RefUnwindSafe for CsvFormat
impl Send for CsvFormat
impl Sync for CsvFormat
impl Unpin for CsvFormat
impl UnwindSafe for CsvFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more