External Publication
Visit Post

Could collections hypothetically store keys and values inline?

Rust Internals [Unofficial] April 25, 2026
Source

Vorpal:

Why would you want to make that guarantee? I could absolutely see the case for HashMap using specialisation in the future to store small keys and values inline.

String would also benefit from small string optimization, see for example compact_str. The stdlib precluded this optimization however.

Discussion in the ATmosphere

Loading comments...