]> git.proxmox.com Git - rustc.git/blob - vendor/time/src/format_description/well_known/rfc2822.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / vendor / time / src / format_description / well_known / rfc2822.rs
1 //! The format described in RFC 2822.
2
3 /// The format described in [RFC 2822](https://tools.ietf.org/html/rfc2822#section-3.3).
4 ///
5 /// Example: Fri, 21 Nov 1997 09:55:06 -0600
6 ///
7 /// # Examples
8 #[cfg_attr(feature = "parsing", doc = "```rust")]
9 #[cfg_attr(not(feature = "parsing"), doc = "```rust,ignore")]
10 /// # use time::{format_description::well_known::Rfc2822, OffsetDateTime};
11 /// use time_macros::datetime;
12 /// assert_eq!(
13 /// OffsetDateTime::parse("Sat, 12 Jun 1993 13:25:19 GMT", &Rfc2822)?,
14 /// datetime!(1993-06-12 13:25:19 +00:00)
15 /// );
16 /// # Ok::<_, time::Error>(())
17 /// ```
18 ///
19 #[cfg_attr(feature = "formatting", doc = "```rust")]
20 #[cfg_attr(not(feature = "formatting"), doc = "```rust,ignore")]
21 /// # use time::format_description::well_known::Rfc2822;
22 /// # use time_macros::datetime;
23 /// assert_eq!(
24 /// datetime!(1997-11-21 09:55:06 -06:00).format(&Rfc2822)?,
25 /// "Fri, 21 Nov 1997 09:55:06 -0600"
26 /// );
27 /// # Ok::<_, time::Error>(())
28 /// ```
29 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
30 pub struct Rfc2822;