home.social

#rustcollections — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #rustcollections, aggregated by home.social.

  1. 🔍 #Rustlang Tip: Use Vec::with_capacity(n) when you know the approximate size of your vector beforehand. This will reserve memory for the vector to avoid multiple allocations.

    This is a performance optimization and shouldn't change the behavior of the code in most situations.

    Be careful though, if you overestimate the size of the vector you will waste memory!

    #RustCollections #Rust30by30 #Day16