Skip to main content

TaskComponent

Trait TaskComponent 

Source
pub trait TaskComponent<'a>: Component {
    type Data: SystemData<'a>;

    // Required method
    fn run(&mut self, data: &mut Self::Data) -> bool;
}
Expand description

An ephemeral component that needs access to SystemData to run some task. Will be run by the TaskRunnerSystem<T> until run returns true.

Note: TaskComponent::Data isn’t allowed to contain Storage<TaskComponent>, since the TaskRunnerSystem already uses that resource and borrows it mutably while calling TaskComponent::run. If you really need access to Storage<TaskComponent>, you can safely use the LazyUpdate resource for that.

Required Associated Types§

Required Methods§

Source

fn run(&mut self, data: &mut Self::Data) -> bool

Returns true iff the task is complete.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§