vizia_core/
entity.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use vizia_id::{
    impl_generational_id, GenerationalId, GENERATIONAL_ID_GENERATION_MASK,
    GENERATIONAL_ID_INDEX_BITS, GENERATIONAL_ID_INDEX_MASK,
};

/// An entity is an identifier used to reference a view; to get/set properties in the context.
///
/// Rather than having widgets own their data, all state is stored in a single database and
/// is stored and loaded using entities.
///
/// The [root entity](GenerationalId::root) represents the main window and is always valid. It can be used to set
/// properties on the primary window, such as background-color, as well as sending events
/// to the window.
///
/// [root entity]: GenerationalId::root()
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub struct Entity(u64);

impl_generational_id!(Entity);