rustdoc::html::url_parts_builder

Constant AVG_PART_LENGTH

source
const AVG_PART_LENGTH: usize = 8;
Expand description

This is just a guess at the average length of a URL part, used for String::with_capacity calls in the FromIterator and Extend impls, and for estimating item path lengths.

The value 8 was chosen for two main reasons:

  • It seems like a good guess for the average part length.
  • jemalloc’s size classes are all multiples of eight, which means that the amount of memory it allocates will often match the amount requested, avoiding wasted bytes.