pub fn insert_with<T, F>(
component_fn: F,
mode: InsertMode,
) -> impl EntityCommand
Expand description
An EntityCommand
that adds a component to an entity using
some function that returns the component.
The function will only be invoked if the component will actually be inserted.
In other words, the function will not be invoked if mode
is InsertMode::Keep
and the entity already has the component.