euv_engine/entity/type.rs
1use super::*;
2
3/// A reference-counted, shared-mutable handle to a `dyn Component` trait object.
4///
5/// Held behind `EngineCell` (an `UnsafeCell`-backed `Sync` newtype) so the
6/// storage matches the rest of the engine's `static mut` convention.
7/// Use [`EngineCell::get_mut`] for exclusive mutable access.
8pub type ComponentRc = Rc<EngineCell<dyn Component>>;
9
10/// A reference-counted, shared-mutable handle to an `Entity`.
11///
12/// Mirrors [`ComponentRc`] - the underlying storage is `EngineCell<Entity>`
13/// rather than `Rc<RefCell<Entity>>`. The naming and ownership semantics
14/// stay the same; only the interior mutability mechanism changes.
15pub type EntityRc = Rc<EngineCell<Entity>>;
16
17/// A handler function that processes an `EntityEvent`.
18pub type EventHandler = Rc<dyn Fn(&EntityEvent)>;
19
20/// A handler function that processes an `EntityEvent`.
21pub type EventHandlers = HashMap<String, Vec<EventHandler>>;