Struct Dispatcher

Source
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>

Source

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.

Source

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.

Source

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

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl<'a, 'b, 'c> RunNow<'a> for Dispatcher<'b, 'c>

Source§

fn run_now(&mut self, res: &Resources)

Runs the system now. Read more
Source§

fn setup(&mut self, res: &mut Resources)

Sets up Resources for a later call to run_now.
Source§

fn dispose(self: Box<Dispatcher<'b, 'c>>, res: &mut Resources)

Performs clean up that requires resources from the Resources. Read more

Auto Trait Implementations§

§

impl<'a, 'b> Freeze for Dispatcher<'a, 'b>

§

impl<'a, 'b> !RefUnwindSafe for Dispatcher<'a, 'b>

§

impl<'a, 'b> !Send for Dispatcher<'a, 'b>

§

impl<'a, 'b> !Sync for Dispatcher<'a, 'b>

§

impl<'a, 'b> Unpin for Dispatcher<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for Dispatcher<'a, 'b>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Any for T
where T: Any,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Erased for T