Skip to content
← All tracks

Collections, Text and First Iterators

Rust

`Vec`, `HashMap`, `BTreeMap`, the Entry API, and `String` vs `&str` vs bytes vs chars — plus enough iterator vocabulary to make Track 6 readable.

This track is written for Rust, which isn't the mode you're browsing in.

0 / 19 solved · 2 articles
  1. 1. Not solved yet. Vec surgery: retain, dedup and extract_if
  2. 2. Capacity, Amortisation, and Why Rust Collections Never Shrink Read
  3. 3. Not solved yet. String building: push_str, write!, and the 590x cliff
  4. 4. Not solved yet. Joining owned strings
  5. 5. Not solved yet. Case-insensitive search without allocating
  6. 6. Not solved yet. Zero-copy parsing: borrow, don't allocate
  7. 7. Not solved yet. HashMap fundamentals: get, get_mut and the Hash/Eq contract
  8. 8. Not solved yet. The Entry API: one lookup, not two
  9. 9. Not solved yet. HashMap iteration order is random
  10. 10. Not solved yet. BTreeMap range queries
  11. 11. Not solved yet. Set algebra with BTreeSet
  12. 12. Not solved yet. VecDeque and breadth-first search
  13. 13. Not solved yet. BinaryHeap is a max-heap, and Reverse is the fix
  14. 14. Choosing the Container: The std Complexity Table, Annotated Read
  15. 15. Not solved yet. Grouping without itertools: anagram buckets
  16. 16. Not solved yet. windows and chunks are slice methods, not iterator adapters
  17. 17. Not solved yet. Cow: borrow until you have to own
  18. 18. Not solved yet. Cow in API design: impl Into<Cow<str>>
  19. 19. Not solved yet. In-place mutation vs rebuild, measured
  20. 20. Not solved yet. Reusing buffers instead of allocating per iteration
  21. 21. Not solved yet. Everything you can collect into

Check yourself

3 questions · one attempt each

These do not count toward finishing the track. They are here to catch the things that are easy to read past.

0 / 3

"héllo" has five characters. What does .len() return?

let s = String::from("héllo");
s.len()
s.chars().count()
Question 1 of 3