densa-ui 0.2.1

The widget layer of densa: a retained widget tree with flexbox layout, pointer and keyboard events, focus and themes, independent of any window or GPU API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/// Identifies a widget in a [`Ui`](crate::Ui).
///
/// An id stays valid until its widget is removed. A removed widget's slot can hold another
/// widget later, under another generation, so an old id never reaches the new widget.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WidgetId {
    pub(crate) index: u32,
    pub(crate) generation: u32,
}

impl WidgetId {
    pub(crate) fn slot(self) -> usize {
        self.index as usize
    }
}