diff options
author | Nadrieril | 2020-10-28 22:43:34 +0000 |
---|---|---|
committer | Nadrieril | 2020-10-28 22:52:41 +0000 |
commit | 48bb9c03b0ace9efa33315e06c47a868e5c4ed36 (patch) | |
tree | 2e8e3464fee44e88e92c0bb9330d7cf7c56cccf1 /serde_dhall | |
parent | 27377f045a2449c86ea3b680d168d2224c90e5e3 (diff) |
Move table of type correspondances
Diffstat (limited to 'serde_dhall')
-rw-r--r-- | serde_dhall/src/static_type.rs | 26 | ||||
-rw-r--r-- | serde_dhall/src/value.rs | 23 |
2 files changed, 26 insertions, 23 deletions
diff --git a/serde_dhall/src/static_type.rs b/serde_dhall/src/static_type.rs index 7e6c27c..586cd4d 100644 --- a/serde_dhall/src/static_type.rs +++ b/serde_dhall/src/static_type.rs @@ -10,6 +10,10 @@ use crate::SimpleType; /// corresponds to them. For example, `HashMap<String, u64>` could correspond to multiple different /// Dhall types, e.g. `{ foo: Natural, bar: Natural }` and `{ baz: Natural }`. /// +/// See also [the table of type correspondances]. +/// +/// [the table of type correspondances]: enum.SimpleType.html#type-correspondence +/// /// # Example /// /// ```rust @@ -29,28 +33,6 @@ use crate::SimpleType; /// # Ok(()) /// # } /// ``` -/// -/// # Type correspondence -/// -/// The following Dhall types correspond to the following Rust types: -/// -/// Dhall | Rust -/// -------|------ -/// `Bool` | `bool` -/// `Natural` | `u64`, `u32`, ... -/// `Integer` | `i64`, `i32`, ... -/// `Double` | `f64`, `f32`, ... -/// `Text` | `String` -/// `List T` | `Vec<T>` -/// `Optional T` | `Option<T>` -/// `{ x: T, y: U }` | structs -/// `{ _1: T, _2: U }` | `(T, U)`, structs -/// `{ x: T, y: T }` | `HashMap<String, T>`, structs -/// `< x: T \| y: U >` | enums -/// `Prelude.Map.Type Text T` | `HashMap<String, T>`, structs -/// `T -> U` | unsupported -/// `Prelude.JSON.Type` | unsupported -/// `Prelude.Map.Type T U` | unsupported pub trait StaticType { /// Return the Dhall type that represents this type. /// diff --git a/serde_dhall/src/value.rs b/serde_dhall/src/value.rs index 50c12bd..b8ad199 100644 --- a/serde_dhall/src/value.rs +++ b/serde_dhall/src/value.rs @@ -124,6 +124,28 @@ pub enum SimpleValue { /// [`StaticType`]: trait.StaticType.html /// [`Deserializer::static_type_annotation`]: options/struct.Deserializer.html#method.static_type_annotation /// +/// # Type correspondence +/// +/// The following Dhall types correspond to the following Rust types: +/// +/// Dhall | Rust +/// -------|------ +/// `Bool` | `bool` +/// `Natural` | `u64`, `u32`, ... +/// `Integer` | `i64`, `i32`, ... +/// `Double` | `f64`, `f32`, ... +/// `Text` | `String` +/// `List T` | `Vec<T>` +/// `Optional T` | `Option<T>` +/// `{ x: T, y: U }` | structs +/// `{ _1: T, _2: U }` | `(T, U)`, structs +/// `{ x: T, y: T }` | `HashMap<String, T>`, structs +/// `< x: T \| y: U >` | enums +/// `Prelude.Map.Type Text T` | `HashMap<String, T>`, structs +/// `T -> U` | unsupported +/// `Prelude.JSON.Type` | unsupported +/// `Prelude.Map.Type T U` | unsupported +/// /// # Examples /// /// ```rust @@ -159,7 +181,6 @@ pub enum SimpleValue { /// # Ok(()) /// # } /// ``` -/// #[derive(Debug, Clone, PartialEq, Eq)] pub enum SimpleType { /// Corresponds to the Dhall type `Bool` |