Struct maxminddb::Reader[][src]

pub struct Reader {
    pub metadata: Metadata,
    // some fields omitted
}

A reader for the MaxMind DB format

Fields

Methods

impl<'de> Reader
[src]

Open a MaxMind DB database file.

Example

let reader = maxminddb::Reader::open("test-data/test-data/GeoIP2-City-Test.mmdb").unwrap();

Lookup the socket address in the opened MaxMind DB

Example:

use maxminddb::geoip2;
use std::net::IpAddr;
use std::str::FromStr;

let reader = maxminddb::Reader::open("test-data/test-data/GeoIP2-City-Test.mmdb").unwrap();

let ip: IpAddr = FromStr::from_str("89.160.20.128").unwrap();
let city: geoip2::City = reader.lookup(ip).unwrap();
print!("{:?}", city);

Auto Trait Implementations

impl Send for Reader

impl Sync for Reader