Function indexmap::serde::cautious_capacity
source · pub(crate) fn cautious_capacity<K, V>(hint: Option<usize>) -> usize
Expand description
Limit our preallocated capacity from a deserializer size_hint()
.
We do account for the Bucket
overhead from its saved hash
field, but we don’t count the
RawTable
allocation or the fact that its raw capacity will be rounded up to a power of two.
The “max” is an arbitrary choice anyway, not something that needs precise adherence.
This is based on the internal serde::de::size_hint::cautious(hint)
function.