@@ -23,10 +23,9 @@ pub struct MicroSecondsTimestampVisitor;
23
23
#[ derive( Debug ) ]
24
24
pub struct MilliSecondsTimestampVisitor ;
25
25
26
- /// Serialize into an ISO 8601 formatted string.
26
+ /// Serialize into an ISO 8601 formatted string, with a format similar to RFC 3339 .
27
27
///
28
- /// See [the `serde` module](./serde/index.html) for alternate
29
- /// serializations.
28
+ /// See [the `serde` module](crate::serde) for alternate serializations.
30
29
impl < Tz : TimeZone > ser:: Serialize for DateTime < Tz > {
31
30
fn serialize < S > ( & self , serializer : S ) -> Result < S :: Ok , S :: Error >
32
31
where
@@ -54,7 +53,7 @@ impl<'de> de::Visitor<'de> for DateTimeVisitor {
54
53
type Value = DateTime < FixedOffset > ;
55
54
56
55
fn expecting ( & self , formatter : & mut fmt:: Formatter ) -> fmt:: Result {
57
- formatter. write_str ( "a formatted date and time string or a unix timestamp " )
56
+ formatter. write_str ( "an RFC 3339 formatted date and time string" )
58
57
}
59
58
60
59
fn visit_str < E > ( self , value : & str ) -> Result < Self :: Value , E >
@@ -65,13 +64,9 @@ impl<'de> de::Visitor<'de> for DateTimeVisitor {
65
64
}
66
65
}
67
66
68
- /// Deserialize a value that optionally includes a timezone offset in its
69
- /// string representation
67
+ /// Deserialize an RFC 3339 formatted string into a `DateTime<FixedOffset>`.
70
68
///
71
- /// The value to be deserialized must be an rfc3339 string.
72
- ///
73
- /// See [the `serde` module](./serde/index.html) for alternate
74
- /// deserialization formats.
69
+ /// See [the `serde` module](crate::serde) for alternate deserialization formats.
75
70
impl < ' de > de:: Deserialize < ' de > for DateTime < FixedOffset > {
76
71
fn deserialize < D > ( deserializer : D ) -> Result < Self , D :: Error >
77
72
where
@@ -81,12 +76,11 @@ impl<'de> de::Deserialize<'de> for DateTime<FixedOffset> {
81
76
}
82
77
}
83
78
84
- /// Deserialize into a UTC value
79
+ /// Deserialize an RFC 3339 formatted string into a `DateTime<Utc>`.
85
80
///
86
- /// The value to be deserialized must be an rfc3339 string .
81
+ /// If the value contains an offset from UTC that is not zero, the value will be converted to UTC .
87
82
///
88
- /// See [the `serde` module](./serde/index.html) for alternate
89
- /// deserialization formats.
83
+ /// See [the `serde` module](crate::serde) for alternate deserialization formats.
90
84
impl < ' de > de:: Deserialize < ' de > for DateTime < Utc > {
91
85
fn deserialize < D > ( deserializer : D ) -> Result < Self , D :: Error >
92
86
where
@@ -96,13 +90,12 @@ impl<'de> de::Deserialize<'de> for DateTime<Utc> {
96
90
}
97
91
}
98
92
99
- /// Deserialize a value that includes no timezone in its string
100
- /// representation
93
+ /// Deserialize an RFC 3339 formatted string into a `DateTime<Local>`.
101
94
///
102
- /// The value to be deserialized must be an rfc3339 string.
95
+ /// The value will remain the same instant in UTC, but the offset will be recalculated to match
96
+ /// that of the `Local` platform time zone.
103
97
///
104
- /// See [the `serde` module](./serde/index.html) for alternate
105
- /// serialization formats.
98
+ /// See [the `serde` module](crate::serde) for alternate deserialization formats.
106
99
#[ cfg( feature = "clock" ) ]
107
100
impl < ' de > de:: Deserialize < ' de > for DateTime < Local > {
108
101
fn deserialize < D > ( deserializer : D ) -> Result < Self , D :: Error >
0 commit comments