Changing URL's port field from Option<u16> to Option<NonZeroU16> would enable some memory layout optimizations, allowing port to have the same size as u16. Trying this out locally results in a 10% smaller memory footprint for Url (88 bytes -> 80 bytes).
Changing URL's port field from
Option<u16>
toOption<NonZeroU16>
would enable some memory layout optimizations, allowingport
to have the same size asu16
. Trying this out locally results in a 10% smaller memory footprint forUrl
(88 bytes -> 80 bytes).