Skip to main content

MmdbDecode

Derive Macro MmdbDecode 

Source
#[derive(MmdbDecode)]
{
    // Attributes available to this derive:
    #[serde]
}
Expand description

Derives borrowed MMDB map decoding for a struct.

Fields such as &str and &[u8] borrow the source database bytes. Field-level #[serde(rename = "...")] attributes select the corresponding MMDB map key. Unsupported or missing required fields produce a decoding error.

§Examples

ⓘ
use libmaxminddb_rs::MmdbDecode;
#[derive(MmdbDecode)]
struct Record<'a> { country: &'a str, asn: u32 }