use bevy_ecs::{system::EntityCommands, world::EntityWorldMut};
use crate::{Delivery, DeliveryChoice, DeliverySettings};
impl DeliveryChoice for DeliverySettings {
fn apply_entity_commands<Request: 'static + Send + Sync>(
self,
entity_commands: &mut EntityCommands,
) {
match self {
Self::Serial => {
entity_commands.insert(Delivery::<Request>::serial());
}
Self::Parallel => {
entity_commands.insert(Delivery::<Request>::parallel());
}
}
}
fn apply_entity_mut<Request: 'static + Send + Sync>(self, entity_mut: &mut EntityWorldMut) {
match self {
Self::Serial => {
entity_mut.insert(Delivery::<Request>::serial());
}
Self::Parallel => {
entity_mut.insert(Delivery::<Request>::parallel());
}
}
}
}