summaryrefslogtreecommitdiff
path: root/dhall/src/traits
diff options
context:
space:
mode:
authorNadrieril2019-04-11 13:11:52 +0200
committerNadrieril2019-04-11 13:11:52 +0200
commit82d62c4d7d423817a4fd9d6294d27d18d60bcd22 (patch)
tree887b4af84bc2c69886616a4a9c8aa27fa846238a /dhall/src/traits
parent9a060908aae564e7155259a4e12d63be3fb97d9b (diff)
Add basic deserialization support
Closes #13
Diffstat (limited to 'dhall/src/traits')
-rw-r--r--dhall/src/traits/deserialize.rs2
-rw-r--r--dhall/src/traits/static_type.rs24
2 files changed, 25 insertions, 1 deletions
diff --git a/dhall/src/traits/deserialize.rs b/dhall/src/traits/deserialize.rs
index 5271a65..1fbdfe1 100644
--- a/dhall/src/traits/deserialize.rs
+++ b/dhall/src/traits/deserialize.rs
@@ -8,7 +8,7 @@ pub trait Deserialize<'a>: Sized {
impl<'a> Deserialize<'a> for Parsed {
/// Simply parses the provided string. Ignores the
/// provided type.
- fn from_str(s: &'a str, _ty: Option<&Type>) -> Result<Self> {
+ fn from_str(s: &'a str, _: Option<&Type>) -> Result<Self> {
Ok(Parsed::parse_str(s)?)
}
}
diff --git a/dhall/src/traits/static_type.rs b/dhall/src/traits/static_type.rs
index b402ca9..6c41e3f 100644
--- a/dhall/src/traits/static_type.rs
+++ b/dhall/src/traits/static_type.rs
@@ -47,12 +47,36 @@ impl SimpleStaticType for Natural {
}
}
+impl SimpleStaticType for u32 {
+ fn get_simple_static_type() -> SimpleType {
+ mktype(dhall_expr!(Natural))
+ }
+}
+
+impl SimpleStaticType for u64 {
+ fn get_simple_static_type() -> SimpleType {
+ mktype(dhall_expr!(Natural))
+ }
+}
+
impl SimpleStaticType for Integer {
fn get_simple_static_type() -> SimpleType {
mktype(dhall_expr!(Integer))
}
}
+impl SimpleStaticType for i32 {
+ fn get_simple_static_type() -> SimpleType {
+ mktype(dhall_expr!(Integer))
+ }
+}
+
+impl SimpleStaticType for i64 {
+ fn get_simple_static_type() -> SimpleType {
+ mktype(dhall_expr!(Integer))
+ }
+}
+
impl SimpleStaticType for String {
fn get_simple_static_type() -> SimpleType {
mktype(dhall_expr!(Text))