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
sourceimpl<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
sourceimpl<'a, P, T> RunNow<'a> for ParSeq<P, T> where
P: Borrow<ThreadPool>,
T: for<'b> RunWithPool<'b>,
impl<'a, P, T> RunNow<'a> for ParSeq<P, T> where
P: Borrow<ThreadPool>,
T: for<'b> RunWithPool<'b>,
Auto Trait Implementations
impl<P, T> RefUnwindSafe for ParSeq<P, T> where
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<P, T> Send for ParSeq<P, T> where
P: Send,
T: Send,
impl<P, T> Sync for ParSeq<P, T> where
P: Sync,
T: Sync,
impl<P, T> Unpin for ParSeq<P, T> where
P: Unpin,
T: Unpin,
impl<P, T> UnwindSafe for ParSeq<P, T> where
P: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more