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

Creates a new ParSeq dispatcher. run is usually created by using the par! / seq! macros.

Sets up world for dispatching. This will add default values for required resources by calling System::setup.

Dispatches the systems using world. This doesn’t call any virtual functions.

Please note that this method assumes that no resource is currently borrowed. If that’s the case, it panics.

Trait Implementations

Runs the system now. Read more

Sets up World for a later call to run_now.

Performs clean up that requires resources from the World. This commonly removes components from world which depend on external resources. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.