pub struct DecodeLimits {
pub max_depth: usize,
pub max_values: usize,
pub max_payload_bytes: usize,
}Expand description
Resource limits applied while decoding a single data entry or the metadata section.
A MaxMind DB can encode a value as a pointer, and many pointers can share
one target, so a small record can describe a structure that is huge, deeply
nested, or effectively infinite when expanded. These limits bound the time
and memory one decode operation may consume. When a limit is exceeded, the
decode fails with MaxMindDBError::ResourceLimit.
The defaults follow the recommendations in the MaxMind DB specification: a
maximum nesting depth of 512, a maximum of 65_536 decoded values, and a
maximum of 2 MiB of string and byte payload materialized per operation.
The largest records MaxMind produces stay far below these values.
Fields§
§max_depth: usizeMaximum nesting depth. Each nested map, array, or followed pointer adds one level. This also bounds pointer cycles and unbounded pointer chains.
The decoder is recursive, so raising this value increases stack usage
proportionally. The default of 512 is safe on typical thread stacks.
max_values: usizeMaximum number of logical values decoded per operation. Every value, map key, and map value counts once; following a pointer does not add to the count.
max_payload_bytes: usizeMaximum number of string and byte payload bytes materialized per operation. Each occurrence of a string or byte value is charged.