Struct TaskData

Source
pub struct TaskData<'a, P, S, M, F> { /* private fields */ }

Implementations§

Source§

impl<'a, P, S, M, F> TaskData<'a, P, S, M, F>
where P: GenericReadStorage<Component = TaskProgress>, S: GenericReadStorage<Component = SingleEdge>, M: GenericReadStorage<Component = MultiEdge>, &'a P: 'a + Join,

Source

pub fn make_task_with_entity_lazy<'b, T: TaskComponent<'b> + Send + Sync>( &self, entity: Entity, task: T, )

Like make_task, but use entity for tracking the task components. This can make it easier to manage tasks coupled with a specific entity (rather than storing a separate task entity in a component).

Source

pub fn make_task_lazy<'b, T: TaskComponent<'b> + Send + Sync>( &self, task: T, ) -> Entity

Create a new task entity with the given TaskComponent. The task will not make progress until it is either finalized or the descendent of a finalized entity.

Source

pub fn make_final_task_lazy<'b, T: TaskComponent<'b> + Send + Sync>( &self, task: T, on_completion: OnCompletion, ) -> Entity

Source

pub fn make_fork_lazy(&self) -> Entity

Create a new fork entity with no children.

Source

pub fn add_prong_lazy(&self, fork_entity: Entity, prong: Entity)

Add prong as a child on the MultiEdge of fork_entity.

Source

pub fn join_lazy(&self, parent: Entity, child: Entity)

Creates a SingleEdge from parent to child. Creates a fork-join if parent is a fork.

Source

pub fn finalize_lazy(&self, entity: Entity, on_completion: OnCompletion)

Mark entity as final. This will make all of entity’s descendents visible to the TaskManagerSystem, allowing them to make progress. If OnCompletion::Delete, then entity and all of its descendents will be deleted when entity is complete (and hence the entire graph is complete). Otherwise, you need to clean up the entities your self by calling delete_entity_and_descendents. God help you if you leak an orphaned entity.

Source

pub fn task_is_complete(&self, task: Entity) -> bool

Returns true iff the task was seen as complete on the last run of the TaskManagerSystem.

Source

pub fn entity_is_complete(&self, entity: Entity) -> bool

Tells you whether a fork or a task entity is complete.

Source

pub fn count_tasks_in_progress(&'a self) -> usize

Returns the number of tasks that haven’t yet completed.

Source

pub fn delete_entity_and_descendents(&self, entity: Entity)

Deletes entity and all of its descendents.

Source

pub fn delete_if_complete(&self, entity: Entity) -> bool

Deletes the entity and descendents if they are all complete. Returns true iff the entity and all descendents are complete.

Source§

impl<'a> TaskData<'a, Storage<'a, TaskProgress, FetchMut<'a, MaskedStorage<TaskProgress>>>, Storage<'a, SingleEdge, FetchMut<'a, MaskedStorage<SingleEdge>>>, Storage<'a, MultiEdge, FetchMut<'a, MaskedStorage<MultiEdge>>>, Storage<'a, FinalTag, FetchMut<'a, MaskedStorage<FinalTag>>>>

Source

pub fn make_task_with_entity<'b, T: TaskComponent<'b> + Send + Sync>( &mut self, entity: Entity, task: T, task_storage: &mut WriteStorage<'_, T>, )

Like make_task, but use entity for tracking the task components.

Source

pub fn make_task<'b, T: TaskComponent<'b> + Send + Sync>( &mut self, task: T, task_storage: &mut WriteStorage<'_, T>, ) -> Entity

Create a new task entity with the given TaskComponent. The task will not make progress until it is either finalized or the descendent of a finalized entity.

Source

pub fn make_final_task_with_entity<'b, T: TaskComponent<'b> + Send + Sync>( &mut self, entity: Entity, task: T, on_completion: OnCompletion, task_storage: &mut WriteStorage<'_, T>, ) -> Entity

Same as make_task_with_entity, but also finalizes the task.

Source

pub fn make_final_task<'b, T: TaskComponent<'b> + Send + Sync>( &mut self, task: T, on_completion: OnCompletion, task_storage: &mut WriteStorage<'_, T>, ) -> Entity

Same as make_task, but also finalizes the task.

Source

pub fn make_fork(&mut self) -> Entity

Create a new fork entity with no children.

Source

pub fn add_prong(&mut self, fork_entity: Entity, prong: Entity)

Add prong as a child on the MultiEdge of fork_entity.

Source

pub fn join(&mut self, parent: Entity, child: Entity)

Creates a SingleEdge from parent to child. Creates a fork-join if parent is a fork.

Source

pub fn finalize(&mut self, entity: Entity, on_completion: OnCompletion)

Mark entity as final. This will make all of entity’s descendents visible to the TaskManagerSystem, allowing them to make progress. If OnCompletion::Delete, then entity and all of its descendents will be deleted when entity is complete (and hence the entire graph is complete). Otherwise, you need to clean up the entities your self by calling delete_entity_and_descendents. God help you if you leak an orphaned entity.

Trait Implementations§

Source§

impl<'a, P, S, M, F> SystemData<'a> for TaskData<'a, P, S, M, F>
where Entities<'a>: SystemData<'a>, Read<'a, LazyUpdate>: SystemData<'a>, P: SystemData<'a>, S: SystemData<'a>, M: SystemData<'a>, F: SystemData<'a>,

Source§

fn setup(world: &mut World)

Sets up the system data for fetching it from the World.
Source§

fn fetch(world: &'a World) -> Self

Fetches the system data from World. Note that this is only specified for one concrete lifetime 'a, you need to implement the SystemData trait for every possible lifetime.
Source§

fn reads() -> Vec<ResourceId>

Returns all read dependencies as fetched from Self::fetch. Read more
Source§

fn writes() -> Vec<ResourceId>

Returns all write dependencies as fetched from Self::fetch. Read more

Auto Trait Implementations§

§

impl<'a, P, S, M, F> Freeze for TaskData<'a, P, S, M, F>
where P: Freeze, S: Freeze, M: Freeze, F: Freeze,

§

impl<'a, P, S, M, F> !RefUnwindSafe for TaskData<'a, P, S, M, F>

§

impl<'a, P, S, M, F> !Send for TaskData<'a, P, S, M, F>

§

impl<'a, P, S, M, F> !Sync for TaskData<'a, P, S, M, F>

§

impl<'a, P, S, M, F> Unpin for TaskData<'a, P, S, M, F>
where P: Unpin, S: Unpin, M: Unpin, F: Unpin,

§

impl<'a, P, S, M, F> !UnwindSafe for TaskData<'a, P, S, M, F>

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<'a, T> DynamicSystemData<'a> for T
where T: SystemData<'a>,

Source§

type Accessor = StaticAccessor<T>

The accessor of the SystemData, which specifies the read and write dependencies and does the fetching.
Source§

fn setup(_: &StaticAccessor<T>, world: &mut World)

Sets up World for fetching this system data.
Source§

fn fetch(_: &StaticAccessor<T>, world: &'a World) -> T

Creates a new resource bundle by fetching the required resources from the World struct. 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> Resource for T
where T: Any,