From 5c3b0ea6f567bccae3bfd32a0f38e6a544fac94d Mon Sep 17 00:00:00 2001 From: Lucas Pickering Date: Sat, 28 Dec 2024 09:49:51 -0500 Subject: [PATCH] feat: Add from_body to Deserializer --- crates/hcl-rs/src/de/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/hcl-rs/src/de/mod.rs b/crates/hcl-rs/src/de/mod.rs index 3ddf5a3c..0bc52217 100644 --- a/crates/hcl-rs/src/de/mod.rs +++ b/crates/hcl-rs/src/de/mod.rs @@ -30,6 +30,11 @@ impl Deserializer { let body = parser::parse(input)?; Ok(Deserializer { body }) } + + /// Creates a HCL deserializer from a HCL body + pub fn from_body(body: Body) -> Self { + Self { body } + } } /// Deserialize an instance of type `T` from a string of HCL text.