pub unsafe trait DistinctStorage { }
Expand description

This is a marker trait which requires you to uphold the following guarantee:

Multiple threads may call get_mut() with distinct indices without causing > undefined behavior.

This is for example valid for Vec:

vec![1, 2, 3];

We may modify both element 1 and 2 at the same time; indexing the vector mutably does not modify anything else than the respective elements.

As a counter example, we may have some kind of cached storage; it caches elements when they’re retrieved, so pushes a new element to some cache-vector. This storage is not allowed to implement DistinctStorage.

Implementing this trait marks the storage safe for concurrent mutation (of distinct elements), thus allows join_par().

Implementors

This is safe because you cannot mutate ZSTs.