Macro node_map

Source
macro_rules! node_map {
    (
        $(($key:expr, $val:expr)),*$(,)?
    ) => { ... };
}
Expand description

Construct a NodeMap from a list of (Into<String>, Into<Node>) tuples.

See the list of traits on Node.

ยงExample

let array_node = node_map! {
    ("1", "one"),
    ("two", 2),
    ("pi", 3.14),
};

let test_array_node = Node::Map(HashMap::from([
    ("1".to_string(), Node::String("one".to_string())),
    ("two".to_string(), Node::Int64(2)),
    ("pi".to_string(), Node::Double(3.14))
]));

assert_eq!(array_node, test_array_node);