Expand description
hcl-rs
This crate provides functionality to deserialize and manipulate HCL data.
The main types are Deserializer for deserializing data and Value which can
be used to deserialize arbitrary HCL data.
Note: Serializing to HCL is not supported.
Example
use serde_json::{json, Value};
let input = r#"
some_attr = {
foo = [1, 2]
bar = true
}
some_block "some_block_label" {
attr = "value"
}
"#;
let expected = json!({
"some_attr": {
"foo": [1, 2],
"bar": true
},
"some_block": {
"some_block_label": {
"attr": "value"
}
}
});
let value: Value = hcl::from_str(input).unwrap();
assert_eq!(value, expected);License
The source code of hcl-rs is released under the MIT License. See the bundled LICENSE file for details.
Re-exports
pub use de::from_reader;pub use de::from_slice;pub use de::from_str;pub use error::Error;pub use error::Result;pub use structure::Attribute;pub use structure::Block;pub use structure::BlockBuilder;pub use structure::BlockLabel;pub use structure::Body;pub use structure::BodyBuilder;pub use structure::Structure;pub use value::Map;pub use value::Value;Modules
Deserialize HCL data to a Rust data structure.
The Error and Result types used by this crate.
Types to represent HCL structures.
The Value enum, a loosely typed way of representing any valid HCL value.
Enums
Represents a HCL number.
Functions
Parses a HCL Body from a &str.