Serde rfc 2822 - #1412
Conversation
|
Continuing from @pitdicker #1292 (comment):
I changed it to deserialize to |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1412 +/- ##
==========================================
+ Coverage 91.72% 91.85% +0.12%
==========================================
Files 38 38
Lines 17266 17561 +295
==========================================
+ Hits 15838 16130 +292
- Misses 1428 1431 +3 ☔ View full report in Codecov by Sentry. |
pitdicker
left a comment
There was a problem hiding this comment.
We are inevitably going to get a request to add an optional variant. But lets get this ready first.
|
|
||
| #[doc(hidden)] | ||
| #[derive(Debug)] | ||
| pub struct Rfc2822Visitor; |
There was a problem hiding this comment.
I believe you can make this private. The others are public for backwards compatibility.
| type Value = DateTime<FixedOffset>; | ||
|
|
||
| fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | ||
| formatter.write_str("an RFC 2822 (email) formatted datetime string") |
There was a problem hiding this comment.
Personally I would remove (email) .
| where | ||
| S: ser::Serializer, | ||
| { | ||
| serializer.serialize_str(&dt.to_rfc2822()) |
There was a problem hiding this comment.
In format/formatting.rs there is a write_rfc2822 function that works without allocating. Using that will make this serializer work on no_std targets like the others (and make the CI pass).
You will have to adjust its #[cfg(feature = "alloc")] to also enable it with the serde feature.
|
Forgot to add: thank you for working on this! And the changes are related enough to be squashed into one commit please. |
|
@chrisranderson are you still interested in completing this PR? |
|
No, sorry. Gratefully, I am now employed. Sorry to leave this hanging loose. |
|
Congratulations! And no worries. |
|
Opened #1477. |
I'm not sure what this means - every change is compatible with semver, right? Are you asking if it's a backwards-incompatible change?
Done.