npe_graph/id.rs
1//! Stable, copyable identifiers for graph elements.
2//!
3//! All three are generational keys: 64 bits, `Copy`, hashable, orderable.
4//! A removed element's ID is never re-issued for a different element, so IDs
5//! are safe to hold in selections, undo logs, and serialized GUI state.
6
7use slotmap::new_key_type;
8
9new_key_type! {
10 /// Identifies a node (component). See [`crate::Graph::add_node`].
11 pub struct NodeId;
12 /// Identifies a port. Ports are owned by exactly one node.
13 pub struct PortId;
14 /// Identifies an edge between two ports.
15 pub struct EdgeId;
16}