What is the purpose of std?

For Vec it bugs me that it's asymmetric with memory handling: it doesn't release memory automatically when shrinking which makes it a poor default design for lists because you're risking allocating a lot more memory than you're using (e.g. O(n^2) vs O(n)). And now that design choice is stuck in std forever.

Sure, but that could be done in a less intrusive way: cargo new could simply put in a dependency on some stdio crate by default.

2 Likes