Skip to main content

MAX_SUBDIVISIONS

Constant MAX_SUBDIVISIONS 

Source
pub const MAX_SUBDIVISIONS: usize = 32;
Expand description

Maximum number of subdivisions accepted while deserializing the built-in City and Enterprise schemas.

Geographic records ordinarily contain only a small administrative hierarchy. This input constraint applies to every Serde format, not only MaxMind DB. The record fields remain public Vecs, so callers may still construct and serialize a value above the limit; deserializing it again will fail. Custom schemas should likewise apply a semantic limit to collection fields when decoding data that is not trusted.

An otherwise valid oversized MMDB list that reaches this visitor is reported as crate::MaxMindDbError::Decoding. Malformed input may instead produce crate::MaxMindDbError::InvalidDatabase, and decoder-wide limits reported as crate::MaxMindDbError::ResourceLimit take precedence. Other Serde formats report their own deserializer error type.