ailloli_ui_runtime/element/
key.rs

1//! Stable sibling keys used by retained-tree reconciliation.
2
3/// Identity key for a declarative child within one parent.
4///
5/// Variants with equal displayed text remain distinct (`Static("1")` is not
6/// `String("1")`). Keys need only be unique among siblings; reconciliation
7/// combines them with tree structure rather than treating them as global IDs.
8///
9/// # Examples
10///
11/// ```
12/// use ailloli_ui_runtime::element::Key;
13/// assert_ne!(Key::Static("7"), Key::String("7".into()));
14/// assert_eq!(Key::U64(7), Key::U64(7));
15/// ```
16#[derive(Debug, Clone, PartialEq, Eq, Hash)]
17pub enum Key {
18    /// Borrowed program-static identifier with no allocation.
19    Static(&'static str),
20    /// Numeric identifier.
21    U64(u64),
22    /// Owned dynamic UTF-8 identifier; empty strings are valid.
23    String(String),
24}