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§
type Data: SystemData<'a>
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.