From fd4a81b1a92c1859941538b7f2212c621f4b43fd Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 22 Mar 2020 21:29:36 +0000 Subject: Hide SimpleValue from api --- serde_dhall/src/lib.rs | 4 ++-- serde_dhall/src/simple.rs | 8 +++----- serde_dhall/src/value.rs | 3 +-- 3 files changed, 6 insertions(+), 9 deletions(-) (limited to 'serde_dhall') diff --git a/serde_dhall/src/lib.rs b/serde_dhall/src/lib.rs index e59255c..19d3f7e 100644 --- a/serde_dhall/src/lib.rs +++ b/serde_dhall/src/lib.rs @@ -174,7 +174,7 @@ doc_comment::doctest!("../../README.md"); /// Finer-grained control over deserializing Dhall values pub mod options; -/// Serde-compatible Dhall values and their type +/// Serde-compatible Dhall types pub mod simple; /// Arbitrary Dhall values pub mod value; @@ -192,6 +192,6 @@ pub use deserialize::Deserialize; pub(crate) use deserialize::Sealed; pub use error::{Error, Result}; pub use shortcuts::{from_str, from_str_manual_type, from_str_static_type}; -pub use simple::{Type as SimpleType, Value as SimpleValue}; +pub use simple::{Type as SimpleType}; pub use static_type::StaticType; pub use value::Value; diff --git a/serde_dhall/src/simple.rs b/serde_dhall/src/simple.rs index 3d77853..6f3dc93 100644 --- a/serde_dhall/src/simple.rs +++ b/serde_dhall/src/simple.rs @@ -6,14 +6,13 @@ use dhall::syntax::{Builtin, ExprKind, NumKind, Span}; use crate::{Deserialize, Error, Result, Sealed}; /// A simple value of the kind that can be encoded/decoded with serde -/// TODO #[derive(Debug, Clone, PartialEq, Eq)] -pub struct Value { +pub(crate) struct Value { kind: Box, } #[derive(Debug, Clone, PartialEq, Eq)] -pub enum ValKind { +pub(crate) enum ValKind { // TODO: redefine NumKind locally Num(NumKind), Text(String), @@ -24,8 +23,7 @@ pub enum ValKind { Union(String, Option), } -/// The type of a `simple::Value`. -/// TODO +/// The type of a value that can be decoded by Serde. For example, `{ x: Bool, y: List Natural }`. #[derive(Debug, Clone, PartialEq, Eq)] pub struct Type { kind: Box, diff --git a/serde_dhall/src/value.rs b/serde_dhall/src/value.rs index 2557efe..41a96ea 100644 --- a/serde_dhall/src/value.rs +++ b/serde_dhall/src/value.rs @@ -26,8 +26,7 @@ impl Value { } /// Converts a Value into a SimpleValue. - /// TODO - pub fn to_simple_value(&self) -> Option { + pub(crate) fn to_simple_value(&self) -> Option { self.as_simple_val.clone() } /// Converts a Value into a SimpleType. -- cgit v1.2.3