pub type TaskWriter<'a> = TaskData<'a, WriteStorage<'a, TaskProgress>, WriteStorage<'a, SingleEdge>, WriteStorage<'a, MultiEdge>, WriteStorage<'a, FinalTag>>;
Expand description
Creates and modifies task graph entities. Effects are immediate, not lazy like TaskUser
, so
this requires using WriteStorage
for task graph components.
Aliased Type§
pub struct TaskWriter<'a> { /* private fields */ }
Implementations§
Source§impl<'a> TaskWriter<'a>
impl<'a> TaskWriter<'a>
Sourcepub fn make_task_with_entity<'b, T: TaskComponent<'b> + Send + Sync>(
&mut self,
entity: Entity,
task: T,
task_storage: &mut WriteStorage<'_, T>,
)
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.
Sourcepub fn make_task<'b, T: TaskComponent<'b> + Send + Sync>(
&mut self,
task: T,
task_storage: &mut WriteStorage<'_, T>,
) -> Entity
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.
Sourcepub 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
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.
Sourcepub fn make_final_task<'b, T: TaskComponent<'b> + Send + Sync>(
&mut self,
task: T,
on_completion: OnCompletion,
task_storage: &mut WriteStorage<'_, T>,
) -> Entity
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.
Sourcepub fn add_prong(&mut self, fork_entity: Entity, prong: Entity)
pub fn add_prong(&mut self, fork_entity: Entity, prong: Entity)
Add prong
as a child on the MultiEdge
of fork_entity
.
Sourcepub fn join(&mut self, parent: Entity, child: Entity)
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.
Sourcepub fn finalize(&mut self, entity: Entity, on_completion: OnCompletion)
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.