Simultaneous mutable access to arbitrary indices of a large vector that are guaranteed to be disjoint
问题 Context I have a case where multiple threads must update objects stored in a shared vector. However, the vector is very large, and the number of elements to update is relatively small. Problem In a minimal example, the set of elements to update can be identified by a (hash-)set containing the indices of elements to update. The code could hence look as follows: let mut big_vector_of_elements = generate_data_vector(); while has_things_to_do() { let indices_to_update = compute_indices(); indices