Skip to main content

partition_dedup_by

Function partition_dedup_by 

Source
fn partition_dedup_by<K: Eq, V>(
    v: &mut [(K, V)],
) -> (&mut [(K, V)], &mut [(K, V)])
Expand description

Moves all but the last of consecutive elements to the end of the slice satisfying equality on K.

Returns two slices. The first contains no consecutive repeated elements. The second contains all the duplicates in no specified order.

This is based on std::slice::partition_dedup_by (currently unstable) but retains the last element of the duplicate run in the first slice (instead of first).