MaxMindDB-UF
User-friendly library to interact with MaxMind City database
This is simple wrapper around maxminddb crate.
Example:
let reader = open_readfile.uwnrap;
let normalized_db = from;
let addr = from_str.unwrap;
let record = normalized_db.lookup; // Returns Result<NormalizedRecord, MaxMindDBError>
let record = record.unwrap;
record.postal_code; // Option<&str>
record.city_name
and more functions.
Why this wrapper is created?
Just let me show you sample of code that you may use with this crate.
let country = record
.country_name
.or
.or;
or
let localized_name = record
.country_name
.or;
I have thoughts that looks better than.
let record = maxminddb.lookup;
let c = record.country
.and_then
.and_then;
if let None = c
Example with falling back through represented country and registered country would be bigger instead of few lines with this wrapper.