Skip to main content

compile_csv_into

Function compile_csv_into 

pub fn compile_csv_into<R, F>(
    read: R,
    builder: &mut MmdbBuilder,
    map_row: F,
) -> Result<(), CsvError>
where R: Read, F: FnMut(&[&str]) -> Result<Option<CsvGeoRecord>, Box<str>>,
Available on crate feature net only.
Expand description

Compile range-based CSV into an existing MmdbBuilder.

This is the lowest-level entry point: you own the builder, so you choose how to finish — MmdbBuilder::build for an in-memory image, MmdbReader::from_bytes for a live reader, or MmdbBuilder::write_to_file to stream it to disk.

map_row receives the parsed fields of each row and returns Ok(Some(record)) to store a range, Ok(None) to skip the row, or Err(reason) to fail with a CsvError::Parse carrying the record number.

§Errors

Returns CsvError on I/O failure, a row the mapper rejects, or overlapping ranges.