Skip to main content

compile_csv

Function compile_csv 

pub fn compile_csv<R, F>(
    read: R,
    ip_version: IpVersion,
    database_type: impl Into<String>,
    languages: &[&str],
    map_row: F,
) -> Result<MmdbReader, 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 in-memory MmdbReader.

A convenience wrapper over compile_csv_into for the common case; see it for the map_row contract. Use compile_csv_into + MmdbBuilder::write_to_file to stream a large database to disk instead.

§Errors

Returns CsvError on I/O failure, a rejected row, overlapping ranges, or if the compiled image is not a valid database.