From 9d05b401ffc10288b41cd17fc920606af33fe5a4 Mon Sep 17 00:00:00 2001 From: Lucas Pickering Date: Fri, 10 Jan 2025 06:48:13 -0500 Subject: [PATCH] feat: Add from_body to Deserializer (#399) --- 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.