Skip to main content

GeoIpHandler

Trait GeoIpHandler 

Source
pub trait GeoIpHandler: Send + Sync {
    // Required method
    fn get_country(&self, ip: IpAddr) -> Option<String>;
}
Expand description

The geolocation seam: the ISO 3166-1 alpha-2 country code of an address, None when the address is not geolocated.

The reference protocol is GeoIPHandler.get_country(ip); this port is sync and assumed ready (the reference initializes its handler on first use). An empty string reads as unresolved, like Python’s falsy check.

Required Methods§

Source

fn get_country(&self, ip: IpAddr) -> Option<String>

The country code of ip, or None when not geolocated.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§