Skip to content

iddqd 0.4.6

Latest

Choose a tag to compare

@github-actions github-actions released this 21 Jul 22:31
· 2 commits to main since this release

Added

  • from_iter_unique constructors on IdHashMap, BiHashMap, and TriHashMap, matching the existing IdOrdMap::from_iter_unique. These build a map from an iterator and, rather than overwriting, return an error on the first item that conflicts with an already-inserted one.

    Because a value in a BiHashMap or TriHashMap can conflict on more than one key at once, the error reports every distinct existing item it collides with (up to two for BiHashMap and up to three for TriHashMap).

Changed

  • MSRV updated to Rust 1.86.

Fixed

  • Deserialization no longer preallocates based on an unbounded size hint. Length-prefixed formats such as bincode and postcard derive their size hint from the input, so a small hostile payload claiming a huge number of elements could previously cause an excessively large allocation before any element was read. Preallocation is now capped at 1 MiB worth of items, matching what serde does for the standard library's collections.

  • The insert_overwrite path on IdHashMap no longer aborts when an allocation fails, matching the existing guarantee on BiHashMap and TriHashMap. Instead, it results in a catchable panic. (The map is left unchanged, similar to BiHashMap and TriHashMap.)

    Note that BTreeMap::insert_overwrite will abort on allocation failure, because it calls into std which doesn't have an equivalent to HashMap::try_reserve.

Other improvements

  • The insert paths now do fewer redundant checks for duplicates. Thanks izuzak for your first contribution!