Trait specs::storage::DistinctStorage
source · pub unsafe trait DistinctStorage { }
Expand description
This is a marker trait which requires you to uphold the following guarantee:
Safety
Multiple threads may call
SharedGetMutStorage::shared_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.
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 par_join()
.