Macro alumina::tag [−][src]
macro_rules! tag { (@parse $v:expr) => { ... }; ( $($x:expr),* ) => { ... }; }
NodeTag / OpTag constructor for nodes and operations
Returns a value of the type Vec<NodeTag>
or Vec<OpTag>
, relying on inference from surrounding code.
Three or four types of values can be entered as a list into the macro, with the following conversions taking place:
Value | Output | |
---|---|---|
Parameter | => | NodeTag::Parameter` |
5 | => | NodeTag::Int(5)` |
"input" | => | NodeTag::Str("input".to_string())` |
id_binding | => | NodeTag::Id(id_binding)` |
All of these conversions are also possible for OpTag
with the exception of Parameter values
#Example
#[macro_use] extern crate alumina; use alumina::id::NodeTag; fn main() { let s1: Vec<NodeTag> = tag![Parameter, 5, "input"]; let s2: Vec<NodeTag> = vec![NodeTag::Parameter, NodeTag::Int(5), NodeTag::Str("input".to_string())]; assert_eq!(s1, s2); }