pub struct ParSeq<P, T> { /* private fields */ }
Expand description
A dispatcher intended to be used with
Par
and Seq
structures.
This is more flexible and performant than Dispatcher
,
however, you have to check conflicts yourself.
That means you cannot run two systems in parallel
which write to the same resource; if you’d do that,
one of the systems will panic while trying to fetch
the SystemData
.
Thread-local systems
This dispatcher also allows more freedom
for thread-local systems; you can execute wherever you want,
just not in parallel with other systems (putting one inside
par!
will give you a compile-time error saying the Send
requirement
is unmet).
Examples
#[macro_use(par, seq)]
extern crate shred;
let x = 5u8;
let mut dispatcher = ParSeq::new(
seq![
par![SysA, SysWithLifetime(&x), seq![SysC, SysD,],],
SysB,
SysLocal(&x as *const u8),
],
&pool,
);
dispatcher.dispatch(&mut world);
Implementations§
source§impl<P, T> ParSeq<P, T>where
P: Borrow<ThreadPool>,
T: for<'a> RunWithPool<'a>,
impl<P, T> ParSeq<P, T>where
P: Borrow<ThreadPool>,
T: for<'a> RunWithPool<'a>,
Trait Implementations§
Auto Trait Implementations§
impl<P, T> RefUnwindSafe for ParSeq<P, T>where
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<P, T> Send for ParSeq<P, T>
impl<P, T> Sync for ParSeq<P, T>
impl<P, T> Unpin for ParSeq<P, T>
impl<P, T> UnwindSafe for ParSeq<P, T>where
P: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more