diff --git a/src/parser/ast.rs b/src/parser/ast.rs index 6879ac9..141ad20 100644 --- a/src/parser/ast.rs +++ b/src/parser/ast.rs @@ -264,7 +264,8 @@ pub enum Offset { } impl Offset { - pub fn value_millis(&self) -> i128 { + #[cfg(feature = "ser")] + pub(crate) fn as_millis(&self) -> i128 { match self { Self::Pos(dur) => dur.as_millis() as i128, Self::Neg(dur) => -(dur.as_millis() as i128), @@ -272,11 +273,14 @@ impl Offset { } #[cfg(feature = "ser")] - pub fn serialize_offset(offset: &Option, serializer: S) -> Result + pub(crate) fn serialize_offset( + offset: &Option, + serializer: S, + ) -> Result where S: serde::Serializer, { - let value = offset.as_ref().map(|o| o.value_millis()).unwrap_or(0); + let value = offset.as_ref().map(|o| o.as_millis()).unwrap_or(0); serializer.serialize_i128(value) } } diff --git a/src/parser/function.rs b/src/parser/function.rs index c05c42e..1b90fed 100644 --- a/src/parser/function.rs +++ b/src/parser/function.rs @@ -108,7 +108,7 @@ impl Function { } #[cfg(feature = "ser")] - pub fn serialize_variadic(variadic: &bool, serializer: S) -> Result + pub(crate) fn serialize_variadic(variadic: &bool, serializer: S) -> Result where S: serde::Serializer, { diff --git a/src/util/duration.rs b/src/util/duration.rs index 93a5c3c..472e3fd 100644 --- a/src/util/duration.rs +++ b/src/util/duration.rs @@ -136,7 +136,7 @@ pub fn display_duration(duration: &Duration) -> String { } #[cfg(feature = "ser")] -pub fn serialize_duration(dur: &Duration, serializer: S) -> Result +pub(crate) fn serialize_duration(dur: &Duration, serializer: S) -> Result where S: serde::Serializer, { @@ -145,7 +145,10 @@ where } #[cfg(feature = "ser")] -pub fn serialize_duration_opt(dur: &Option, serializer: S) -> Result +pub(crate) fn serialize_duration_opt( + dur: &Option, + serializer: S, +) -> Result where S: serde::Serializer, {