#[repr(C)]pub struct GeoInfo {
pub country_code: [u8; 2],
pub is_eu: bool,
pub region: u8,
}Expand description
Compact classification result for a single IP range.
The country code is stored as two ASCII bytes (e.g. b'D', b'E'), and is_eu
is a convenience flag derived from a built-in EU membership list.
region is stored as a small numeric code; use GeoInfo::region_enum
for a typed view.
Fields§
§country_code: [u8; 2]§is_eu: bool§region: u8Implementations§
Source§impl GeoInfo
For display/testing convenience.
impl GeoInfo
For display/testing convenience.
Sourcepub fn country_code_str(&self) -> &str
pub fn country_code_str(&self) -> &str
Return the ISO-3166 alpha-2 country code as a string slice.
This is intended for display/logging and should always be valid ASCII.
If the stored bytes are not valid UTF-8 (unexpected), this falls back to "??".
Sourcepub fn region_enum(&self) -> Region
pub fn region_enum(&self) -> Region
Interpret the stored numeric region code as a [Region] enum.
Unknown or unsupported codes map to [Region::Other].
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GeoInfo
impl RefUnwindSafe for GeoInfo
impl Send for GeoInfo
impl Sync for GeoInfo
impl Unpin for GeoInfo
impl UnwindSafe for GeoInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more