1use core::any::TypeId;
5
6use std::collections::HashMap;
8
9use super::world::Id;
11
12#[non_exhaustive]
13#[derive(Debug)]
14pub struct Entity {
15 pub id: Id,
16 pub parent_id_option: Option<Id>,
17 pub children_ids: Vec<Id>,
18 pub components_id_map: HashMap<TypeId, Vec<Id>>
19}
20
21impl Entity {
22 #[must_use]
23 pub fn new(id: Id) -> Self {
24 Self {
25 id,
26 parent_id_option: None,
27 children_ids: vec![],
28 components_id_map: HashMap::new()
29 }
30 }
31
32 #[must_use]
33 pub fn new_child(id: Id, parent_id: Id) -> Self {
34 Self {
35 id,
36 parent_id_option: Some(parent_id),
37 children_ids: vec![],
38 components_id_map: HashMap::new()
39 }
40 }
41}
42