Skip to main content

dedup_values

Function dedup_values 

Source
pub fn dedup_values<'a, I>(items: I) -> Vec<VmValue>
where I: IntoIterator<Item = &'a VmValue>,
Expand description

Structural de-duplication that honors values_equal, preserving first-occurrence order.

Candidates are bucketed by value_structural_hash_key (so the common case stays near-O(n)), then every hash hit is confirmed with values_equal. Because the hash key is consistent with values_equal, numerically-equal values that hash alike (e.g. 1 and 1.0) collapse to a single entry, while hash collisions between unequal values (e.g. two NaNs sharing a bit pattern) never merge — matching the == operator exactly.