pub struct Dispatcher<'a, 'b> { /* private fields */ }Expand description
The dispatcher struct, allowing systems to be executed in parallel.
Implementations§
Source§impl<'a, 'b> Dispatcher<'a, 'b>
impl<'a, 'b> Dispatcher<'a, 'b>
Sourcepub fn setup(&mut self, res: &mut Resources)
pub fn setup(&mut self, res: &mut Resources)
Sets up all the systems which means they are gonna add default values for the resources they need.
Sourcepub fn dispose(self, res: &mut Resources)
pub fn dispose(self, res: &mut Resources)
Calls the dispose method of all systems and allows them to release
external resources. It is common this method removes components and
/ or resources from the Resources which are associated with external
resources.
Calling any method after dispose (including dispose itself) will
panic.
Sourcepub fn dispatch(&mut self, res: &Resources)
pub fn dispatch(&mut self, res: &Resources)
Dispatch all the systems with given resources and context and then run thread local systems.
This function automatically redirects to
dispatch_parin case it is supporteddispatch_seqotherwise
and runs dispatch_thread_local afterwards.
Please note that this method assumes that no resource is currently borrowed. If that’s the case, it panics.
Sourcepub fn dispatch_seq(&mut self, res: &Resources)
pub fn dispatch_seq(&mut self, res: &Resources)
Dispatches the systems (except thread local systems) sequentially.
This is useful if parallel overhead is too big or the platform does not support multithreading.
Please note that this method assumes that no resource is currently borrowed. If that’s the case, it panics.
Sourcepub fn dispatch_thread_local(&mut self, res: &Resources)
pub fn dispatch_thread_local(&mut self, res: &Resources)
Dispatch only thread local systems sequentially.
Please note that this method assumes that no resource is currently borrowed. If that’s the case, it panics.