vizia_core/
entity.rs

1use vizia_id::{
2    impl_generational_id, GenerationalId, GENERATIONAL_ID_GENERATION_MASK,
3    GENERATIONAL_ID_INDEX_BITS, GENERATIONAL_ID_INDEX_MASK,
4};
5
6/// An entity is an identifier used to reference a view; to get/set properties in the context.
7///
8/// Rather than having widgets own their data, all state is stored in a single database and
9/// is stored and loaded using entities.
10///
11/// The [root entity](GenerationalId::root) represents the main window and is always valid. It can be used to set
12/// properties on the primary window, such as background-color, as well as sending events
13/// to the window.
14///
15/// [root entity]: GenerationalId::root()
16#[derive(Clone, Copy, PartialEq, Eq, Hash)]
17pub struct Entity(u64);
18
19impl_generational_id!(Entity);