add serde serialization support for TimeWithTimeZone
use crate::{direct_function_call_as_datum, pg_sys, FromDatum, IntoDatum, PgBox};
+use serde::Serializer;
use std::ops::Deref;
use time::UtcOffset;
@@ -102,6 +103,15 @@ impl Deref for TimeWithTimeZone {
}
}
+impl serde::Serialize for TimeWithTimeZone {
+ fn serialize<S>(&self, serializer: S) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
+ where
+ S: Serializer,
+ {
+ self.0.serialize(serializer)
+ }
+}
+
impl IntoDatum<TimeWithTimeZone> for TimeWithTimeZone {
#[inline]
fn into_datum(self) -> Option<pg_sys::Datum> {
