From c2b4a2d9b40efbe4f6cb6fd04f6cb90639f4985f Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 12 May 2019 18:44:28 +0200 Subject: Implement binary encoding Closes #39 --- dhall/src/phase/parse.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'dhall/src/phase/parse.rs') diff --git a/dhall/src/phase/parse.rs b/dhall/src/phase/parse.rs index 765fc09..734f6e1 100644 --- a/dhall/src/phase/parse.rs +++ b/dhall/src/phase/parse.rs @@ -22,6 +22,12 @@ pub fn parse_str(s: &str) -> Result { Ok(Parsed(expr, root)) } +pub fn parse_binary(data: &[u8]) -> Result { + let expr = crate::phase::binary::decode(data)?; + let root = ImportRoot::LocalDir(std::env::current_dir()?); + Ok(Parsed(expr.note_absurd(), root)) +} + pub fn parse_binary_file(f: &Path) -> Result { let mut buffer = Vec::new(); File::open(f)?.read_to_end(&mut buffer)?; -- cgit v1.2.3