pub unsafe trait ParJoin {
type Type;
type Value;
type Mask: BitSetLike;
// Required methods
unsafe fn open(self) -> (Self::Mask, Self::Value);
unsafe fn get(value: &Self::Value, id: Index) -> Self::Type;
// Provided methods
fn par_join(self) -> JoinParIter<Self>
where Self: Sized { ... }
fn is_unconstrained() -> bool { ... }
}
Expand description
The purpose of the ParJoin
trait is to provide a way
to access multiple storages in parallel at the same time with
the merged bit set.
Safety
ParJoin::get
must be callable from multiple threads, simultaneously.
The Self::Mask
value returned with the Self::Value
must correspond such
that it is safe to retrieve items from Self::Value
whose presence is
indicated in the mask. As part of this, BitSetLike::iter
must not produce
an iterator that repeats an Index
value.
Required Associated Types§
sourcetype Mask: BitSetLike
type Mask: BitSetLike
Type of joined bit mask.
Required Methods§
sourceunsafe fn open(self) -> (Self::Mask, Self::Value)
unsafe fn open(self) -> (Self::Mask, Self::Value)
Open this join by returning the mask and the storages.
Safety
This is unsafe because implementations of this trait can permit the
Value
to be mutated independently of the Mask
. If the Mask
does
not correctly report the status of the Value
then illegal memory
access can occur.
Provided Methods§
sourcefn par_join(self) -> JoinParIter<Self>where
Self: Sized,
fn par_join(self) -> JoinParIter<Self>where Self: Sized,
Create a joined parallel iterator over the contents.
sourcefn is_unconstrained() -> bool
fn is_unconstrained() -> bool
If this LendJoin
typically returns all indices in the mask, then
iterating over only it or combined with other joins that are also
dangerous will cause the JoinLendIter
to go through all indices which
is usually not what is wanted and will kill performance.