macro_rules! expression {
($($expr:tt)+) => { ... };
}
Expand description
Construct an hcl::Expression
from an HCL attribute value expression literal.
For supported syntax see the body!
macro documentation.
ยงExample
use hcl::{Expression, Identifier, Object, ObjectKey};
let other = "hello";
let expression = hcl::expression!({
foo = true
"baz qux" = [1, 2]
(other) = "world"
});
let expected = Expression::Object(Object::from([
(ObjectKey::from(Identifier::new("foo")?), true.into()),
(ObjectKey::from("baz qux"), vec![1u64, 2].into()),
(ObjectKey::from("hello"), "world".into()),
]));
assert_eq!(expression, expected);