Collections, ownership, and borrowing
Store values in collections and choose when to transfer, copy, or borrow them.
- Build and update a list
- Transfer or copy ownership
- Take part of a list or text
- Borrow a collection
- Borrow an element
- Handle allocation failures
- Associate keys with values Optional lookup handles missing entries explicitly.
- Keep distinct values in a set
- Remove values and take ownership
- Group different types in tuples
- Sort and reorder a list
- Clean up owned values
- Build singly and doubly linked lists
The collection examples provide additional operations.