Struct email::rfc822::Rfc822DateParser [−][src]
pub struct Rfc822DateParser<'s> { /* fields omitted */ }
Parser for RFC822 style dates, as defined by Section 5.
Note that this also supports the additions as specified in RFC5322 Section 3.3 while still being backward compatible. [unstable]
Methods
impl<'s> Rfc822DateParser<'s>
[src]
impl<'s> Rfc822DateParser<'s>
pub fn new(s: &'s str) -> Rfc822DateParser<'s>
[src]
pub fn new(s: &'s str) -> Rfc822DateParser<'s>
[unstable]
pub fn consume_datetime(&mut self) -> ParsingResult<DateTime<FixedOffset>>
[src]
pub fn consume_datetime(&mut self) -> ParsingResult<DateTime<FixedOffset>>
Consume a DateTime from the input.
If successful, returns a DateTime with a fixed offset based on the timezone parsed. You may wish to deal with this in UTC, in which case you may want something like
extern crate chrono; extern crate email; use email::rfc822::Rfc822DateParser; use chrono::Utc; fn main() { let mut p = Rfc822DateParser::new("Thu, 18 Dec 2014 21:07:22 +0100"); let d = p.consume_datetime().unwrap(); let as_utc = d.with_timezone(&Utc); assert_eq!(d, as_utc); }
[unstable]
Auto Trait Implementations
impl<'s> Send for Rfc822DateParser<'s>
impl<'s> Send for Rfc822DateParser<'s>
impl<'s> Sync for Rfc822DateParser<'s>
impl<'s> Sync for Rfc822DateParser<'s>