Simultaneous mutable access to arbitrary indices of a large vector that are guaranteed to be disjoint

You can sort indices_to_update and extract mutable references by calling split_*_mut. let len = big_vector_of_elements.len(); while has_things_to_do() { let mut tail = big_vector_of_elements.as_mut_slice(); let mut indices_to_update = compute_indices(); // I assumed compute_indices() returns unsorted vector // to highlight the importance of sorted order indices_to_update.sort(); let mut elems = Vec::new(); for idx in indices_to_update { // … Read more