impl_entity

Macro impl_entity 

Source
macro_rules! impl_entity {
    ($entity_name:ident) => { ... };
}
Expand description

Implements the Entity trait for the given existing type and defines a type alias of the form MyEntityId = EntityId<MyEntity>. For simple zero-sized types, use the define_entity! macro instead, which will define the struct and derive all the super traits.

This macro ensures the correct implementation of the Entity trait. The tricky bit is the implementation of Entity::index, which requires synchronization in multithreaded runtimes. This is an instance of correctness via macro.