diff --git a/ui/src/components.rs b/ui/src/components.rs index 644cc1fa..d72378a0 100644 --- a/ui/src/components.rs +++ b/ui/src/components.rs @@ -83,9 +83,11 @@ pub struct Entity { } impl From> for Entity { - fn from(kind: Box) -> Entity { + fn from(mut kind: Box) -> Entity { + let id = Uuid::new_v4(); + kind.set_id(id); Entity { - id: Uuid::new_v4(), + id: id, component: kind, } } @@ -95,9 +97,11 @@ impl From> for Entity where C: Component, { - fn from(kind: Box) -> Entity { + fn from(mut kind: Box) -> Entity { + let id = Uuid::new_v4(); + kind.set_id(id); Entity { - id: Uuid::new_v4(), + id: id, component: kind, } } @@ -143,7 +147,8 @@ pub trait Component: Display + Debug { true } fn set_dirty(&mut self); - fn kill(&mut self, _uuid: Uuid) {} + fn kill(&mut self, uuid: Uuid) {} + fn set_id(&mut self, uuid: Uuid) {} } /*