Skip to main content

Crate babbel_hcl

Crate babbel_hcl 

Source
Expand description

§Babbel HCL

Fast, pure-Rust parser, serializer, and [FormatEngine] implementation for HashiCorp Configuration Language v2 (HCL2) (.hcl, .tf, .tfvars).

§Quickstart

use babbel_hcl::{from_str, to_string_pretty};

let hcl_src = r#"
variable "region" {
    default = "us-east-1"
}
"#;

let val = from_str(hcl_src).unwrap();
let out = to_string_pretty(&val, 2).unwrap();
assert!(out.contains("variable"));

Re-exports§

pub use engine::HclEngine;
pub use error::HclError;
pub use eval::HclEvalContext;
pub use parser::HclParser;
pub use parser::from_str;
pub use parser::from_str_with_context;
pub use serializer::HclSerializerConfig;
pub use serializer::to_string;
pub use serializer::to_string_pretty;

Modules§

engine
FormatEngine implementation for HCL v2.
error
Error types for HCL (HashiCorp Configuration Language) operations.
eval
HCL v2 / Terraform Expression & Built-in Function Evaluation Engine.
parser
Recursive descent parser for HashiCorp HCL v2 syntax into universal Value AST.
serializer
Serializer emitting universal Value AST into HCL v2 syntax.

Enums§

Value
Universal hierarchical data value across XML, JSON, YAML, and Bencode representations.

Functions§

from_bytes
Deserialize a universal Babbel Value from raw HCL byte slice.
from_slice
Deserialize a universal Babbel Value from raw HCL byte slice.
to_vec
Serialize a universal Babbel Value into an HCL byte vector (Vec<u8>).