use crate::ecs;
#[derive(Debug)]
pub struct HandlerRegistry<'world> {
pub(crate) world: &'world mut ecs::World,
}
impl HandlerRegistry<'_> {
pub fn register<M>(&mut self, handler: impl ecs::IntoHandler<M>) {
self.world.add_handler(handler);
}
}
pub struct ActionSender<'world> {
pub(crate) world: &'world mut ecs::World,
}
impl ActionSender<'_> {
pub fn send<E: ecs::GlobalEvent>(&mut self, event: E) {
self.world.send(event);
}
pub fn send_to<E: ecs::TargetedEvent>(&mut self, target: ecs::EntityId, event: E) {
self.world.send_to(target, event);
}
}