Tree.Node_idSourceUnique identifier for nodes in a layout tree.
Node identifiers use a generational index scheme to prevent use-after-free errors. Each identifier contains an index (position in the tree's internal storage) and a generation number (incremented when the slot is reused). This detects stale references to removed nodes.
Invariants:
make index creates a node identifier with generation 0.
Used by the tree when allocating new nodes.
make_with_generation index generation creates a node identifier with the specified index and generation.
Used by the tree when reusing freed node slots with incremented generation.
to_int node_id returns the index component.
Discards the generation. Use only for indexing into internal storage after validating the full identifier.
generation node_id returns the generation component.
Used by the tree to detect stale references when validating identifiers.
equal lhs rhs tests if two identifiers reference the same node.
Returns true only if both index and generation match.
compare lhs rhs orders identifiers lexicographically by index, then generation.
Enables use in ordered data structures like Map and Set.
pp fmt node_id prints the identifier as NodeId(index,generation).