macro_rules! value {
($($expr:tt)+) => { ... };
}
Expand description
Construct an hcl::Value
from an HCL attribute value value literal.
Supports the same input syntax as the expression!
macro, with the exception of raw value
expressions.
For supported syntax see the body!
macro documentation.
ยงExample
use hcl::{Value, Identifier, Map};
let other = "hello";
let value = hcl::value!({
foo = true
"baz qux" = [1, 2]
(other) = "world"
});
let expected = Value::Object({
let mut object = Map::new();
object.insert("foo".into(), true.into());
object.insert("baz qux".into(), vec![1u64, 2].into());
object.insert("hello".into(), "world".into());
object
});
assert_eq!(value, expected);