Struct flax::schedule::Schedule

source ·
pub struct Schedule { /* private fields */ }
Expand description

A schedule of systems to execute with automatic parallelization.

Implementations§

source§

impl Schedule

source

pub fn new() -> Self

Creates a new empty schedule, prefer Self::builder

source

pub fn builder() -> ScheduleBuilder

Creates a new schedule builder

source

pub fn execute_seq(&mut self, world: &mut World) -> Result<()>

Execute all systems in the schedule sequentially on the world. Returns the first error and aborts if the execution fails.

source

pub fn execute_par(&mut self, world: &mut World) -> Result<()>

Available on crate feature rayon only.

Executes the systems in the schedule in parallel.

Systems will run in an order such that changes and mutable accesses made by systems provided before are observable when the system runs.

Systems with no dependencies between each other may run in any order, but will not run before any previously provided system which it depends on.

A dependency between two systems is given by a side effect, e.g; a component write, which is accessed by the seconds system through a read or other side effect.

source

pub fn from_systems(systems: impl Into<Vec<BoxedSystem>>) -> Self

Creates a schedule from a group of existing systems

source

pub fn append(&mut self, other: Self)

Append one schedule onto another

source

pub fn with_system(self, system: impl Into<BoxedSystem>) -> Self

Add a new system to the schedule. Respects order.

source

pub fn flush(self) -> Self

Applies the commands inside of the commandbuffer

source

pub fn batch_info(&mut self, world: &World) -> BatchInfos

Returns information about the current multithreaded batch partioning and system accesses.

source

pub fn execute_seq_with<'a>( &'a mut self, world: &'a mut World, input: impl IntoInput<'a> ) -> Result<()>

Same as Self::execute_seq but allows supplying short lived input available to the systems

The data can be a mutable reference type, or a tuple of mutable references

source

pub fn execute_par_with<'a>( &'a mut self, world: &'a mut World, input: impl IntoInput<'a> ) -> Result<()>

Available on crate feature rayon only.

Same as Self::execute_par but allows supplying short lived data available to the systems

Trait Implementations§

source§

impl Debug for Schedule

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Schedule

source§

fn default() -> Schedule

Returns the “default value” for a type. Read more
source§

impl<U> From<U> for Schedule
where U: IntoIterator<Item = BoxedSystem>,

source§

fn from(v: U) -> Self

Converts to this type from the input type.
source§

impl FromIterator<BoxedSystem> for Schedule

source§

fn from_iter<I: IntoIterator<Item = BoxedSystem>>(iter: I) -> Self

Creates a value from an iterator. Read more

Auto Trait Implementations§

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> 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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

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

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

§

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

§

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> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> ComponentValue for T
where T: Send + Sync + 'static,