whisker_runtime/element.rs
1//! Element tag enum, shared between the `render!` macro emit and
2//! the bridge tag-mapping table.
3//!
4//! Pre-Phase-6.5a this module also held the `Element` value-tree
5//! struct + attribute / event / child data and the diff/patch flow
6//! consumed by `render.rs`. That entire pipeline retired with A3 —
7//! the fine-grained reactive runtime mutates the Lynx element tree
8//! directly through `view::*` rather than building an intermediate
9//! Rust-side data structure. Only the tag enum survives because the
10//! C bridge still keys element creation off it.
11
12/// Element tag. Numeric repr stays in sync with `WhiskerElementTag`
13/// in `crates/whisker-driver-sys/bridge/include/whisker_bridge.h`.
14#[repr(u32)]
15#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
16pub enum ElementTag {
17 Page = 1,
18 View = 2,
19 Text = 3,
20 RawText = 4,
21 ScrollView = 5,
22}
23
24impl ElementTag {
25 pub fn name(self) -> &'static str {
26 match self {
27 ElementTag::Page => "page",
28 ElementTag::View => "view",
29 ElementTag::Text => "text",
30 ElementTag::RawText => "raw-text",
31 ElementTag::ScrollView => "scroll-view",
32 }
33 }
34}