Struct email::rfc5322::Rfc5322Parser [] [src]

pub struct Rfc5322Parser<'s> { /* fields omitted */ }

RFC 5322 base parser for parsing atom, dot-atom, quoted-string, phrase, message

This should prove useful for parsing other things that appear in RFC 5322, as most are based off these core items.

It also implements a stack for tracking the position. This allows the simple implementation of backtracking, by pushing the position before a test and popping it if the test should fail. [unstable]

Methods

impl<'s> Rfc5322Parser<'s>
[src]

[src]

Make a new parser, initialized with the given string. [unstable]

[src]

Push the current position onto the stack. [unstable]

[src]

Move the position back to the last entry pushed [unstable]

[src]

Consume a message from the input.

Returns as a map of the headers and the body text.

A message is defined as:

fields = *field body = text message = fields CRLF body [unstable]

[src]

Consume a header from the input.

A header is defined as:

ftext = "!".."9" / ";".."~" field-name = 1*ftext field = field-name *LWSP ":" unstructured [unstable]

[src]

Consume an unstructured from the input. [unstable]

[src]

Consume folding whitespace.

This is a CRLF followed by one or more whitespace character.

Returns true if whitespace was consume [unstable]

[src]

Consume a word from the input.

A word is defined as:

word = atom / quoted-string

If allow_dot_atom is true, then atom can be a dot-atom in this phrase. [unstable]

[src]

Consume a phrase from the input.

A phrase is defined as:

phrase = 1*word

If allow_dot_atom is true, then atom can be a dot-atom in this phrase. [unstable]

[src]

Consume a quoted string from the input [unstable]

[src]

Consume an atom from the input.

If allow_dot is true, then also allow '.' to be considered as an atext character. [unstable]

[src]

Consume LWSP (Linear whitespace) [unstable]

[src]

Consume a single character from the input. [unstable]

[src]

[unstable]

[src]

[unstable]

[src]

Consume a set of characters, each passed to test until this function returns false.

The position after calling this function will be pointing to the character which caused a false result from test.

Returns the string of characters that returned true for the test function. [unstable]

[src]

Peek at the current character.

Note that this does not do any bounds checking. [unstable]

[src]

Check that !self.eof() && self.peek() == c [unstable]

[src]

Check that we have not reached the end of the input. [unstable]

[src]

Get the unconsumed string. Should only be used for debugging purposes! [unstable]

[src]

Returns true if we have reached the end of the input. [unstable]

Trait Implementations

Auto Trait Implementations

impl<'s> Send for Rfc5322Parser<'s>

impl<'s> Sync for Rfc5322Parser<'s>