From 7a1cd09b861c9fe3f598688cadb09cf2fea0ffbf Mon Sep 17 00:00:00 2001 From: Brandon W Maister Date: Sat, 30 Nov 2019 18:25:36 -0500 Subject: [PATCH] Document that rfc2822 is what is used for http and email headers Closes #328 --- src/datetime.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/datetime.rs b/src/datetime.rs index 70400fd..c737479 100644 --- a/src/datetime.rs +++ b/src/datetime.rs @@ -324,6 +324,17 @@ fn map_local(dt: &DateTime, mut f: F) -> Option { /// Parses an RFC 2822 date and time string such as `Tue, 1 Jul 2003 10:52:37 +0200`, /// then returns a new `DateTime` with a parsed `FixedOffset`. + /// + /// RFC 2822 is the internet message standard that specifices the + /// representation of times in HTTP and email headers. + /// + /// ``` + /// # use chrono::{DateTime, FixedOffset, TimeZone}; + /// assert_eq!( + /// DateTime::parse_from_rfc2822("Wed, 18 Feb 2015 23:16:09 GMT").unwrap(), + /// FixedOffset::east(0).ymd(2015, 2, 18).and_hms(23, 16, 9) + /// ); + /// ``` pub fn parse_from_rfc2822(s: &str) -> ParseResult> { const ITEMS: &'static [Item<'static>] = &[Item::Fixed(Fixed::RFC2822)]; let mut parsed = Parsed::new();