Struct tinyecs::Entity
[−]
[src]
pub struct Entity { pub id: i32, pub components: RefCell<HashMap<TypeId, Box<Any>>>, pub removed_components: RefCell<HashSet<TypeId>>, // some fields omitted }
Fields
id | |
components | |
removed_components |
Methods
impl Entity
fn new(id: i32) -> Entity
fn refresh(&self)
Mark this entity as not refreshed. On beginning of next frame new registered components will affect their systems.
fn set_fresh(&self)
fn is_fresh(&self) -> bool
fn add_component<T: Any + Component>(&self, component: T)
fn remove_component<T: Any>(&self)
Remove component of given type from entity Be carefull, if this component is borrowed at this moment, it will not be really deleted.
fn has_component<T: Any>(&self) -> bool
fn get_component<T: Any + Component>(&self) -> ComponentGuard<T>
Move component from entity to CompoentGuard. In general case, it behaves like &mut T. While component is borrowed, second get_component() with same type will cause panic