Macro dot_ix_model::node_id

source ·
node_id!() { /* proc-macro */ }
Expand description

Returns a const NodeId validated at compile time.

§Examples

Instantiate a valid NodeId at compile time:

let _my_node_id: dot_ix::model::common::NodeId = node_id!("valid_id"); // Ok!
//

If the ID is invalid, a compilation error is produced:


let _my_node_id: dot_ix::model::common::NodeId = node_id!("-invalid_id"); // Compile error
//                                               ^^^^^^^^^^^^^^^^^^^^^^^
// error: "-invalid_id" is not a valid `NodeId`.
//        `NodeId`s must begin with a letter or underscore, and contain only letters, numbers, or underscores.