summaryrefslogtreecommitdiff
path: root/serde_dhall/src/static_type.rs
diff options
context:
space:
mode:
authorNadrieril2019-08-13 15:25:53 +0200
committerNadrieril2019-08-13 15:31:15 +0200
commit1ea8b10051d29c634399304273d6ee565d039bc2 (patch)
tree78750a34b6dd54f71bdff8fd835fc705a9ec2582 /serde_dhall/src/static_type.rs
parent74bb40e88c71b80ab785f07fd19da22404ab6e95 (diff)
Merge `Type` and `Value` in serde_dhall
There was no point in separating them
Diffstat (limited to 'serde_dhall/src/static_type.rs')
-rw-r--r--serde_dhall/src/static_type.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/serde_dhall/src/static_type.rs b/serde_dhall/src/static_type.rs
index 13d5d70..67a7bc4 100644
--- a/serde_dhall/src/static_type.rs
+++ b/serde_dhall/src/static_type.rs
@@ -1,6 +1,6 @@
use dhall_syntax::{Builtin, Integer, Natural};
-use crate::Type;
+use crate::Value;
/// A Rust type that can be represented as a Dhall type.
///
@@ -14,14 +14,14 @@ use crate::Type;
/// [StaticType] because each different value would
/// have a different Dhall record type.
pub trait StaticType {
- fn static_type() -> Type;
+ fn static_type() -> Value;
}
macro_rules! derive_builtin {
($ty:ty, $builtin:ident) => {
impl StaticType for $ty {
- fn static_type() -> Type {
- Type::make_builtin_type(Builtin::$builtin)
+ fn static_type() -> Value {
+ Value::make_builtin_type(Builtin::$builtin)
}
}
};
@@ -38,8 +38,8 @@ where
A: StaticType,
B: StaticType,
{
- fn static_type() -> Type {
- Type::make_record_type(
+ fn static_type() -> Value {
+ Value::make_record_type(
vec![
("_1".to_owned(), A::static_type()),
("_2".to_owned(), B::static_type()),
@@ -54,8 +54,8 @@ where
T: StaticType,
E: StaticType,
{
- fn static_type() -> Type {
- Type::make_union_type(
+ fn static_type() -> Value {
+ Value::make_union_type(
vec![
("Ok".to_owned(), Some(T::static_type())),
("Err".to_owned(), Some(E::static_type())),
@@ -69,8 +69,8 @@ impl<T> StaticType for Option<T>
where
T: StaticType,
{
- fn static_type() -> Type {
- Type::make_optional_type(T::static_type())
+ fn static_type() -> Value {
+ Value::make_optional_type(T::static_type())
}
}
@@ -78,8 +78,8 @@ impl<T> StaticType for Vec<T>
where
T: StaticType,
{
- fn static_type() -> Type {
- Type::make_list_type(T::static_type())
+ fn static_type() -> Value {
+ Value::make_list_type(T::static_type())
}
}
@@ -87,7 +87,7 @@ impl<'a, T> StaticType for &'a T
where
T: StaticType,
{
- fn static_type() -> Type {
+ fn static_type() -> Value {
T::static_type()
}
}