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,
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,
Sourcepub fn make_task_with_entity_lazy<'b, T: TaskComponent<'b> + Send + Sync>(
&self,
entity: Entity,
task: T,
)
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).
Sourcepub fn make_task_lazy<'b, T: TaskComponent<'b> + Send + Sync>(
&self,
task: T,
) -> Entity
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.
pub fn make_final_task_lazy<'b, T: TaskComponent<'b> + Send + Sync>( &self, task: T, on_completion: OnCompletion, ) -> Entity
Sourcepub fn make_fork_lazy(&self) -> Entity
pub fn make_fork_lazy(&self) -> Entity
Create a new fork entity with no children.
Sourcepub fn add_prong_lazy(&self, fork_entity: Entity, prong: Entity)
pub fn add_prong_lazy(&self, fork_entity: Entity, prong: Entity)
Add prong
as a child on the MultiEdge
of fork_entity
.
Sourcepub fn join_lazy(&self, parent: Entity, child: Entity)
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.
Sourcepub fn finalize_lazy(&self, entity: Entity, on_completion: OnCompletion)
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.
Sourcepub fn task_is_complete(&self, task: Entity) -> bool
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
.
Sourcepub fn entity_is_complete(&self, entity: Entity) -> bool
pub fn entity_is_complete(&self, entity: Entity) -> bool
Tells you whether a fork or a task entity is complete.
Sourcepub fn count_tasks_in_progress(&'a self) -> usize
pub fn count_tasks_in_progress(&'a self) -> usize
Returns the number of tasks that haven’t yet completed.
Sourcepub fn delete_entity_and_descendents(&self, entity: Entity)
pub fn delete_entity_and_descendents(&self, entity: Entity)
Deletes entity
and all of its descendents.
Sourcepub fn delete_if_complete(&self, entity: Entity) -> bool
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>>>>
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>>>>
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.
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>,
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 fetch(world: &'a World) -> Self
fn fetch(world: &'a World) -> Self
World
. Note that this is only specified
for one concrete lifetime 'a
, you need to implement the
SystemData
trait for every possible lifetime.Auto Trait Implementations§
impl<'a, P, S, M, F> Freeze for TaskData<'a, P, S, M, F>
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>
impl<'a, P, S, M, F> !UnwindSafe for TaskData<'a, P, S, M, F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<'a, T> DynamicSystemData<'a> for Twhere
T: SystemData<'a>,
impl<'a, T> DynamicSystemData<'a> for Twhere
T: SystemData<'a>,
Source§type Accessor = StaticAccessor<T>
type Accessor = StaticAccessor<T>
SystemData
, which specifies the read and write
dependencies and does the fetching.Source§fn setup(_: &StaticAccessor<T>, world: &mut World)
fn setup(_: &StaticAccessor<T>, world: &mut World)
World
for fetching this system data.