From 423fdeebe9247b16744fae4b50df415bbd08be04 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 6 May 2019 22:09:55 +0200 Subject: Reorganize dhall into a phase structure --- dhall/src/lib.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'dhall/src/lib.rs') diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs index a531f64..ec110f7 100644 --- a/dhall/src/lib.rs +++ b/dhall/src/lib.rs @@ -123,18 +123,11 @@ #[macro_use] mod tests; -#[cfg(test)] -mod parser; - -mod binary; /// When manipulating Dhall expressions goes wrong. pub mod error; -pub mod expr; -mod imports; -mod normalize; +mod phase; mod serde; mod traits; -mod typecheck; /// Deserialization of Dhall expressions into Rust pub mod de { @@ -153,7 +146,7 @@ pub mod de { /// expression has that type. pub fn from_str<'a, T: Deserialize<'a>>( s: &'a str, - ty: Option<&crate::expr::Type>, + ty: Option<&crate::phase::Type>, ) -> crate::error::Result { T::from_str(s, ty) } -- cgit v1.2.3 From 60129b7d1c0ea8bdf2ec666fa51957e97465e88f Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 6 May 2019 23:17:26 +0200 Subject: Consolidate errors in the error module --- dhall/src/lib.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'dhall/src/lib.rs') diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs index ec110f7..9f9c315 100644 --- a/dhall/src/lib.rs +++ b/dhall/src/lib.rs @@ -123,7 +123,6 @@ #[macro_use] mod tests; -/// When manipulating Dhall expressions goes wrong. pub mod error; mod phase; mod serde; -- cgit v1.2.3 From 5b91eaa9d6b70a2ac72fe19f2d21871c8d94b017 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 6 May 2019 23:21:19 +0200 Subject: Move api-related modules into an api module --- dhall/src/lib.rs | 41 +++-------------------------------------- 1 file changed, 3 insertions(+), 38 deletions(-) (limited to 'dhall/src/lib.rs') diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs index 9f9c315..989170a 100644 --- a/dhall/src/lib.rs +++ b/dhall/src/lib.rs @@ -123,43 +123,8 @@ #[macro_use] mod tests; +mod api; pub mod error; mod phase; -mod serde; -mod traits; - -/// Deserialization of Dhall expressions into Rust -pub mod de { - pub use crate::traits::{Deserialize, SimpleStaticType, StaticType}; - #[doc(hidden)] - pub use dhall_proc_macros::SimpleStaticType; - - /// Deserialize an instance of type T from a string of Dhall text. - /// - /// This will recursively resolve all imports in the expression, and - /// typecheck it before deserialization. Relative imports will be resolved relative to the - /// provided file. More control over this process is not yet available - /// but will be in a coming version of this crate. - /// - /// If a type is provided, this additionally checks that the provided - /// expression has that type. - pub fn from_str<'a, T: Deserialize<'a>>( - s: &'a str, - ty: Option<&crate::phase::Type>, - ) -> crate::error::Result { - T::from_str(s, ty) - } - - /// Deserialize an instance of type T from a string of Dhall text, - /// additionally checking that it matches the type of T. - /// - /// This will recursively resolve all imports in the expression, and - /// typecheck it before deserialization. Relative imports will be resolved relative to the - /// provided file. More control over this process is not yet available - /// but will be in a coming version of this crate. - pub fn from_str_auto_type<'a, T: Deserialize<'a> + StaticType>( - s: &'a str, - ) -> crate::error::Result { - from_str(s, Some(&::get_static_type())) - } -} +pub use api::de; +pub(crate) use api::traits; -- cgit v1.2.3 From 55b5be3407a8528bc47482a591b168a7cb0ce91e Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 6 May 2019 23:52:15 +0200 Subject: Move main datatypes into their own modules --- dhall/src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'dhall/src/lib.rs') diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs index 989170a..8d1496a 100644 --- a/dhall/src/lib.rs +++ b/dhall/src/lib.rs @@ -123,8 +123,10 @@ #[macro_use] mod tests; -mod api; +pub(crate) mod api; +pub(crate) mod core; pub mod error; -mod phase; -pub use api::de; +pub(crate) mod phase; pub(crate) use api::traits; + +pub use api::de; -- cgit v1.2.3