rust/library/alloc/src/collections
Michael Goulet 262382ff37
Rollup merge of #96173 - jmaargh:jmaargh/with-capacity-doc-fix, r=Dylan-DPC
Fix documentation for  `with_capacity` and `reserve` families of methods

Fixes #95614

Documentation for the following methods
 - `with_capacity`
 - `with_capacity_in`
 - `with_capacity_and_hasher`
 - `reserve`
 - `reserve_exact`
 - `try_reserve`
 - `try_reserve_exact`

was inconsistent and often not entirely correct where they existed on the following types
- `Vec`
- `VecDeque`
- `String`
- `OsString`
- `PathBuf`
- `BinaryHeap`
- `HashSet`
- `HashMap`
- `BufWriter`
- `LineWriter`

since the allocator is allowed to allocate more than the requested capacity in all such cases, and will frequently "allocate" much more in the case of zero-sized types (I also checked `BufReader`, but there the docs appear to be accurate as it appears to actually allocate the exact capacity).

Some effort was made to make the documentation more consistent between types as well.
2022-06-23 14:39:05 -07:00
..
binary_heap Use Box::new() instead of box syntax in alloc tests 2022-05-29 00:41:14 +02:00
btree remove use of &Alloc in btree tests 2022-06-21 16:38:12 -07:00
linked_list Use Box::new() instead of box syntax in alloc tests 2022-05-29 00:41:14 +02:00
vec_deque Fix documentation for with_capacity and reserve families of methods 2022-06-19 20:46:49 +01:00
binary_heap.rs Fix documentation for with_capacity and reserve families of methods 2022-06-19 20:46:49 +01:00
linked_list.rs Use Box::new() instead of box syntax in alloc tests 2022-05-29 00:41:14 +02:00
mod.rs Clarify explicitly that BTree{Map,Set} are ordered. 2022-01-09 18:01:44 -05:00