Serializes an OffsetDateTime to a Unix timestamp (milliseconds since 1970/1/1T00:00:00T)
(date: &OffsetDateTime, serializer: S)
| 43 | |
| 44 | /// Serializes an OffsetDateTime to a Unix timestamp (milliseconds since 1970/1/1T00:00:00T) |
| 45 | pub fn serialize<S>(date: &OffsetDateTime, serializer: S) -> Result<S::Ok, S::Error> |
| 46 | where |
| 47 | S: Serializer, |
| 48 | { |
| 49 | let timestamp = date.unix_timestamp(); |
| 50 | serializer.serialize_i64(timestamp) |
| 51 | } |
| 52 | |
| 53 | /// Attempts to deserialize an i64 and use as a Unix timestamp |
| 54 | pub fn deserialize<'de, D>(deserializer: D) -> Result<OffsetDateTime, D::Error> |
nothing calls this directly
no outgoing calls
no test coverage detected