diff --git a/Cargo.toml b/Cargo.toml index 4d28f1e..ee6f3ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ derive_more = "0.99.17" lazy_static = "1.4.0" regex = "1.7.1" serde = { version = "1.0.152", features = ["derive"], default-features = false } +thiserror = "1.0.49" [dev-dependencies] serde_test = "1.0.152" diff --git a/src/lib.rs b/src/lib.rs index 75629cf..d594448 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -68,6 +68,7 @@ use regex::Regex; use serde::de::Visitor; use serde::Deserialize; use serde::Serialize; +use thiserror::Error; /// A point in time. /// @@ -76,6 +77,7 @@ use serde::Serialize; Eq, PartialEq, Hash, Ord, PartialOrd, Copy, Clone, Debug, Default, Serialize, Deref, From, Into, )] pub struct Time(i64); + impl Time { pub const MAX: Self = Self(i64::MAX); pub const EPOCH: Self = Self(0); @@ -271,6 +273,7 @@ impl<'de> Deserialize<'de> for Time { } struct TimeVisitor; + impl<'de> Visitor<'de> for TimeVisitor { type Value = Time; @@ -317,7 +320,16 @@ impl From