From ccf3adab9a26c5e0734baf842cf7cc62067a1b83 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Sun, 2 Oct 2016 16:03:34 -0400 Subject: Update doc --- target/doc/implementors/core/convert/trait.From.js | 2 +- target/doc/implementors/core/fmt/trait.Debug.js | 2 +- target/doc/implementors/core/fmt/trait.Display.js | 2 +- .../implementors/mailparse/trait.MailHeaderMap.js | 2 +- target/doc/implementors/std/error/trait.Error.js | 2 +- target/doc/mailparse/dateparse/fn.dateparse.html | 10 + target/doc/mailparse/dateparse/index.html | 0 target/doc/mailparse/dateparse/sidebar-items.js | 1 + target/doc/mailparse/enum.MailParseError.html | 21 +- target/doc/mailparse/fn.dateparse.html | 120 +++++ target/doc/mailparse/fn.parse_content_type.html | 9 +- target/doc/mailparse/fn.parse_header.html | 9 +- target/doc/mailparse/fn.parse_headers.html | 9 +- target/doc/mailparse/fn.parse_mail.html | 13 +- target/doc/mailparse/index.html | 153 +++--- target/doc/mailparse/macros/index.html | 0 target/doc/mailparse/macros/sidebar-items.js | 1 + target/doc/mailparse/sidebar-items.js | 2 +- target/doc/mailparse/struct.MailHeader.html | 11 +- target/doc/mailparse/struct.ParsedContentType.html | 17 +- target/doc/mailparse/struct.ParsedMail.html | 17 +- target/doc/mailparse/trait.MailHeaderMap.html | 13 +- target/doc/main.js | 6 +- target/doc/rustdoc.css | 10 +- target/doc/search-index.js | 2 +- target/doc/src/mailparse/src/dateparse.rs.html | 528 +++++++++++++++++++++ target/doc/src/mailparse/src/lib.rs.html | 33 +- target/doc/src/mailparse/src/macros.rs.html | 124 +++++ 28 files changed, 970 insertions(+), 149 deletions(-) create mode 100644 target/doc/mailparse/dateparse/fn.dateparse.html create mode 100644 target/doc/mailparse/dateparse/index.html create mode 100644 target/doc/mailparse/dateparse/sidebar-items.js create mode 100644 target/doc/mailparse/fn.dateparse.html create mode 100644 target/doc/mailparse/macros/index.html create mode 100644 target/doc/mailparse/macros/sidebar-items.js create mode 100644 target/doc/src/mailparse/src/dateparse.rs.html create mode 100644 target/doc/src/mailparse/src/macros.rs.html diff --git a/target/doc/implementors/core/convert/trait.From.js b/target/doc/implementors/core/convert/trait.From.js index f32111e..6db984e 100644 --- a/target/doc/implementors/core/convert/trait.From.js +++ b/target/doc/implementors/core/convert/trait.From.js @@ -1,5 +1,5 @@ (function() {var implementors = {}; -implementors['mailparse'] = ["impl From<QuotedPrintableError> for MailParseError","impl From<Base64Error> for MailParseError","impl From<Cow<'static, str>> for MailParseError",]; +implementors['mailparse'] = ["impl From<QuotedPrintableError> for MailParseError","impl From<Base64Error> for MailParseError","impl From<Cow<'static, str>> for MailParseError",];implementors['mailparse'] = ["impl From<QuotedPrintableError> for MailParseError","impl From<Base64Error> for MailParseError","impl From<Cow<'static, str>> for MailParseError",]; if (window.register_implementors) { window.register_implementors(implementors); diff --git a/target/doc/implementors/core/fmt/trait.Debug.js b/target/doc/implementors/core/fmt/trait.Debug.js index 38e0802..b14d3b3 100644 --- a/target/doc/implementors/core/fmt/trait.Debug.js +++ b/target/doc/implementors/core/fmt/trait.Debug.js @@ -1,5 +1,5 @@ (function() {var implementors = {}; -implementors['mailparse'] = ["impl Debug for MailParseError","impl<'a> Debug for MailHeader<'a>","impl Debug for ParsedContentType","impl<'a> Debug for ParsedMail<'a>",]; +implementors['mailparse'] = ["impl Debug for MailParseError","impl<'a> Debug for MailHeader<'a>","impl Debug for ParsedContentType","impl<'a> Debug for ParsedMail<'a>",];implementors['mailparse'] = ["impl Debug for MailParseError","impl<'a> Debug for MailHeader<'a>","impl Debug for ParsedContentType","impl<'a> Debug for ParsedMail<'a>",]; if (window.register_implementors) { window.register_implementors(implementors); diff --git a/target/doc/implementors/core/fmt/trait.Display.js b/target/doc/implementors/core/fmt/trait.Display.js index a95332e..bb28343 100644 --- a/target/doc/implementors/core/fmt/trait.Display.js +++ b/target/doc/implementors/core/fmt/trait.Display.js @@ -1,5 +1,5 @@ (function() {var implementors = {}; -implementors['mailparse'] = ["impl Display for MailParseError",]; +implementors['mailparse'] = ["impl Display for MailParseError",];implementors['mailparse'] = ["impl Display for MailParseError",]; if (window.register_implementors) { window.register_implementors(implementors); diff --git a/target/doc/implementors/mailparse/trait.MailHeaderMap.js b/target/doc/implementors/mailparse/trait.MailHeaderMap.js index 06c24b8..afa564b 100644 --- a/target/doc/implementors/mailparse/trait.MailHeaderMap.js +++ b/target/doc/implementors/mailparse/trait.MailHeaderMap.js @@ -1,5 +1,5 @@ (function() {var implementors = {}; -implementors['mailparse'] = []; +implementors['mailparse'] = [];implementors['mailparse'] = []; if (window.register_implementors) { window.register_implementors(implementors); diff --git a/target/doc/implementors/std/error/trait.Error.js b/target/doc/implementors/std/error/trait.Error.js index b5b8119..ed55323 100644 --- a/target/doc/implementors/std/error/trait.Error.js +++ b/target/doc/implementors/std/error/trait.Error.js @@ -1,5 +1,5 @@ (function() {var implementors = {}; -implementors['mailparse'] = ["impl Error for MailParseError",]; +implementors['mailparse'] = ["impl Error for MailParseError",];implementors['mailparse'] = ["impl Error for MailParseError",]; if (window.register_implementors) { window.register_implementors(implementors); diff --git a/target/doc/mailparse/dateparse/fn.dateparse.html b/target/doc/mailparse/dateparse/fn.dateparse.html new file mode 100644 index 0000000..672efd7 --- /dev/null +++ b/target/doc/mailparse/dateparse/fn.dateparse.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../mailparse/fn.dateparse.html...

+ + + \ No newline at end of file diff --git a/target/doc/mailparse/dateparse/index.html b/target/doc/mailparse/dateparse/index.html new file mode 100644 index 0000000..e69de29 diff --git a/target/doc/mailparse/dateparse/sidebar-items.js b/target/doc/mailparse/dateparse/sidebar-items.js new file mode 100644 index 0000000..9fffc77 --- /dev/null +++ b/target/doc/mailparse/dateparse/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"fn":[["dateparse","Convert a date field from an email header into a UNIX epoch timestamp. This function handles the most common formatting of date fields found in email headers. It may fail to parse some of the more creative formattings."]]}); \ No newline at end of file diff --git a/target/doc/mailparse/enum.MailParseError.html b/target/doc/mailparse/enum.MailParseError.html index 061e8f1..a7e3eb0 100644 --- a/target/doc/mailparse/enum.MailParseError.html +++ b/target/doc/mailparse/enum.MailParseError.html @@ -11,6 +11,7 @@ + @@ -43,10 +44,10 @@

Enum mailparse::MailParseError - - [] - - [src]

+ + [] + + [src]
pub enum MailParseError {
     QuotedPrintableDecodeError(QuotedPrintableError),
     Base64DecodeError(Base64Error),
@@ -63,13 +64,13 @@ not be successfully decoded as base64 data.

format using the charset specified in the message.

Generic

Some other error occurred while parsing the message; the description string provides additional details.

-

Trait Implementations

impl Display for MailParseError

fn fmt(&self, f: &mut Formatter) -> Result

-

impl Error for MailParseError

fn description(&self) -> &str

+

Trait Implementations

impl Display for MailParseError

fn fmt(&self, f: &mut Formatter) -> Result

+

impl Error for MailParseError

fn description(&self) -> &str

fn cause(&self) -> Option<&Error>

-

impl From<QuotedPrintableError> for MailParseError

fn from(err: QuotedPrintableError) -> MailParseError

-

impl From<Base64Error> for MailParseError

fn from(err: Base64Error) -> MailParseError

-

impl From<Cow<'static, str>> for MailParseError

fn from(err: Cow<'static, str>) -> MailParseError

-

Derived Implementations

impl Debug for MailParseError

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+

impl From<QuotedPrintableError> for MailParseError

fn from(err: QuotedPrintableError) -> MailParseError

+

impl From<Base64Error> for MailParseError

fn from(err: Base64Error) -> MailParseError

+

impl From<Cow<'static, str>> for MailParseError

fn from(err: Cow<'static, str>) -> MailParseError

+

Derived Implementations

impl Debug for MailParseError

fn fmt(&self, __arg_0: &mut Formatter) -> Result

diff --git a/target/doc/mailparse/fn.dateparse.html b/target/doc/mailparse/fn.dateparse.html new file mode 100644 index 0000000..0a6a0fd --- /dev/null +++ b/target/doc/mailparse/fn.dateparse.html @@ -0,0 +1,120 @@ + + + + + + + + + + mailparse::dateparse - Rust + + + + + + + + + + + + + + + + + +
+

Function mailparse::dateparse + + [] + + [src]

+
pub fn dateparse(date: &str) -> Result<i64, &'static str>

Convert a date field from an email header into a UNIX epoch timestamp. +This function handles the most common formatting of date fields found in +email headers. It may fail to parse some of the more creative formattings.

+ +

Examples

+
+    use mailparse::dateparse;
+    assert_eq!(dateparse("Sun, 02 Oct 2016 07:06:22 -0700 (PDT)").unwrap(), 1475417182);
+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/target/doc/mailparse/fn.parse_content_type.html b/target/doc/mailparse/fn.parse_content_type.html index 4dd010d..e81fb02 100644 --- a/target/doc/mailparse/fn.parse_content_type.html +++ b/target/doc/mailparse/fn.parse_content_type.html @@ -11,6 +11,7 @@ + @@ -43,10 +44,10 @@

Function mailparse::parse_content_type - - [] - - [src]

+ + [] + + [src]
pub fn parse_content_type(header: &str) -> Result<ParsedContentType, MailParseError>

Helper method to parse a header value as a Content-Type header. The charset defaults to "us-ascii" if no charset parameter is provided in the header value.

diff --git a/target/doc/mailparse/fn.parse_header.html b/target/doc/mailparse/fn.parse_header.html index 8b053a4..8dbe04d 100644 --- a/target/doc/mailparse/fn.parse_header.html +++ b/target/doc/mailparse/fn.parse_header.html @@ -11,6 +11,7 @@ + @@ -43,10 +44,10 @@

Function mailparse::parse_header - - [] - - [src]

+ + [] + + [src]
pub fn parse_header(raw_data: &[u8]) -> Result<(MailHeader, usize), MailParseError>

Parse a single header from the raw data given. This function takes raw byte data, and starts parsing it, expecting there to be a MIME header key-value pair right at the beginning. It parses that diff --git a/target/doc/mailparse/fn.parse_headers.html b/target/doc/mailparse/fn.parse_headers.html index 46099bf..9a86a17 100644 --- a/target/doc/mailparse/fn.parse_headers.html +++ b/target/doc/mailparse/fn.parse_headers.html @@ -11,6 +11,7 @@ + @@ -43,10 +44,10 @@

Function mailparse::parse_headers - - [] - - [src]

+ + [] + + [src]
pub fn parse_headers(raw_data: &[u8]) -> Result<(Vec<MailHeader>, usize), MailParseError>

Parses all the headers from the raw data given. This function takes raw byte data, and starts parsing it, expecting there to be zero or more MIME header key-value pair right at the beginning, diff --git a/target/doc/mailparse/fn.parse_mail.html b/target/doc/mailparse/fn.parse_mail.html index 3aec0b8..509783e 100644 --- a/target/doc/mailparse/fn.parse_mail.html +++ b/target/doc/mailparse/fn.parse_mail.html @@ -11,6 +11,7 @@ + @@ -43,10 +44,10 @@

Function mailparse::parse_mail - - [] - - [src]

+ + [] + + [src]
pub fn parse_mail(raw_data: &[u8]) -> Result<ParsedMail, MailParseError>

The main mail-parsing entry point. This function takes the raw data making up the message body and returns a structured version of it, which allows easily accessing the header and body @@ -58,6 +59,7 @@ information as needed.

let parsed = parse_mail(concat!( "Subject: This is a test email\n", "Content-Type: multipart/alternative; boundary=foobar\n", + "Date: Sun, 02 Oct 2016 07:06:22 -0700 (PDT)\n", "\n", "--foobar\n", "Content-Type: text/plain; charset=utf-8\n", @@ -80,7 +82,8 @@ information as needed.

"This is the plaintext version, in utf-8. Proof by Euro: \u{20AC}"); assert_eq!(parsed.subparts[1].headers[1].get_value().unwrap(), "base64"); assert_eq!(parsed.subparts[1].ctype.mimetype, "text/html"); - assert!(parsed.subparts[1].get_body().unwrap().starts_with("<html>")); + assert!(parsed.subparts[1].get_body().unwrap().starts_with("<html>")); + assert_eq!(dateparse(parsed.headers.get_first_value("Date").unwrap().unwrap().as_str()).unwrap(), 1475417182);
diff --git a/target/doc/mailparse/index.html b/target/doc/mailparse/index.html index 4921eae..5b6e8a4 100644 --- a/target/doc/mailparse/index.html +++ b/target/doc/mailparse/index.html @@ -11,6 +11,7 @@ + @@ -43,82 +44,85 @@

Crate mailparse - - [] - - [src]

+ + [] + + [src]

Structs

- - - + + - - - - - + + + + - - - - - + + + + - -
MailHeader -

A struct that represents a single header in the message. +

MailHeader +

A struct that represents a single header in the message. It holds slices into the raw byte array passed to parse_mail, and so the lifetime of this struct must be contained within the lifetime of the raw input. There are additional accessor functions on this struct to extract the data as Rust strings.

-
ParsedContentType -

A struct to hold a more structured representation of the Content-Type header. +

ParsedContentType +

A struct to hold a more structured representation of the Content-Type header. This is provided mostly as a convenience since this metadata is usually needed to interpret the message body properly.

-
ParsedMail -

Struct that holds the structured representation of the message. Note that +

ParsedMail +

Struct that holds the structured representation of the message. Note that since MIME allows for nested multipart messages, a tree-like structure is necessary to represent it properly. This struct accomplishes that by holding a vector of other ParsedMail structures for the subparts.

-

Enums

+ +

Enums

- - - + + - -
MailParseError -

An error type that represents the different kinds of errors that may be +

MailParseError +

An error type that represents the different kinds of errors that may be encountered during message parsing.

-

Traits

+ +

Traits

- - - + + - -
MailHeaderMap -

A trait that is implemented by the Vec returned by the parse_headers +

MailHeaderMap +

A trait that is implemented by the Vec returned by the parse_headers function. It provides a map-like interface to look up header values by their name.

-

Functions

+ +

Functions

- - - + + + + + + - - - - - + + + + - - - - - + + + + - - - - - + + + + - -
parse_content_type -

Helper method to parse a header value as a Content-Type header. The charset +

dateparse +

Convert a date field from an email header into a UNIX epoch timestamp. +This function handles the most common formatting of date fields found in +email headers. It may fail to parse some of the more creative formattings.

+
parse_content_type +

Helper method to parse a header value as a Content-Type header. The charset defaults to "us-ascii" if no charset parameter is provided in the header value.

-
parse_header -

Parse a single header from the raw data given. +

parse_header +

Parse a single header from the raw data given. This function takes raw byte data, and starts parsing it, expecting there to be a MIME header key-value pair right at the beginning. It parses that header and returns it, along with the index at which the next header is @@ -126,14 +130,13 @@ expected to start. If you just want to parse a single header, you can ignore the second component of the tuple, which is the index of the next header. Error values are returned if the data could not be successfully interpreted as a MIME key-value pair.

-
parse_headers -

Parses all the headers from the raw data given. +

parse_headers +

Parses all the headers from the raw data given. This function takes raw byte data, and starts parsing it, expecting there to be zero or more MIME header key-value pair right at the beginning, followed by two consecutive newlines (i.e. a blank line). It parses those @@ -144,20 +147,18 @@ returns the index at which the message body is expected to start. If you just care about the headers, you can ignore the second component of the returned tuple. Error values are returned if there was some sort of parsing error.

-
parse_mail -

The main mail-parsing entry point. +

parse_mail +

The main mail-parsing entry point. This function takes the raw data making up the message body and returns a structured version of it, which allows easily accessing the header and body information as needed.

-
+ +
diff --git a/target/doc/mailparse/macros/index.html b/target/doc/mailparse/macros/index.html new file mode 100644 index 0000000..e69de29 diff --git a/target/doc/mailparse/macros/sidebar-items.js b/target/doc/mailparse/macros/sidebar-items.js new file mode 100644 index 0000000..48333d3 --- /dev/null +++ b/target/doc/mailparse/macros/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({}); \ No newline at end of file diff --git a/target/doc/mailparse/sidebar-items.js b/target/doc/mailparse/sidebar-items.js index c827115..40c4f0a 100644 --- a/target/doc/mailparse/sidebar-items.js +++ b/target/doc/mailparse/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"enum":[["MailParseError","An error type that represents the different kinds of errors that may be encountered during message parsing."]],"fn":[["parse_content_type","Helper method to parse a header value as a Content-Type header. The charset defaults to \"us-ascii\" if no charset parameter is provided in the header value."],["parse_header","Parse a single header from the raw data given. This function takes raw byte data, and starts parsing it, expecting there to be a MIME header key-value pair right at the beginning. It parses that header and returns it, along with the index at which the next header is expected to start. If you just want to parse a single header, you can ignore the second component of the tuple, which is the index of the next header. Error values are returned if the data could not be successfully interpreted as a MIME key-value pair."],["parse_headers","Parses all the headers from the raw data given. This function takes raw byte data, and starts parsing it, expecting there to be zero or more MIME header key-value pair right at the beginning, followed by two consecutive newlines (i.e. a blank line). It parses those headers and returns them in a vector. The normal vector functions can be used to access the headers linearly, or the MailHeaderMap trait can be used to access them in a map-like fashion. Along with this vector, the function returns the index at which the message body is expected to start. If you just care about the headers, you can ignore the second component of the returned tuple. Error values are returned if there was some sort of parsing error."],["parse_mail","The main mail-parsing entry point. This function takes the raw data making up the message body and returns a structured version of it, which allows easily accessing the header and body information as needed."]],"struct":[["MailHeader","A struct that represents a single header in the message. It holds slices into the raw byte array passed to parse_mail, and so the lifetime of this struct must be contained within the lifetime of the raw input. There are additional accessor functions on this struct to extract the data as Rust strings."],["ParsedContentType","A struct to hold a more structured representation of the Content-Type header. This is provided mostly as a convenience since this metadata is usually needed to interpret the message body properly."],["ParsedMail","Struct that holds the structured representation of the message. Note that since MIME allows for nested multipart messages, a tree-like structure is necessary to represent it properly. This struct accomplishes that by holding a vector of other ParsedMail structures for the subparts."]],"trait":[["MailHeaderMap","A trait that is implemented by the Vec returned by the parse_headers function. It provides a map-like interface to look up header values by their name."]]}); \ No newline at end of file +initSidebarItems({"enum":[["MailParseError","An error type that represents the different kinds of errors that may be encountered during message parsing."]],"fn":[["dateparse","Convert a date field from an email header into a UNIX epoch timestamp. This function handles the most common formatting of date fields found in email headers. It may fail to parse some of the more creative formattings."],["parse_content_type","Helper method to parse a header value as a Content-Type header. The charset defaults to \"us-ascii\" if no charset parameter is provided in the header value."],["parse_header","Parse a single header from the raw data given. This function takes raw byte data, and starts parsing it, expecting there to be a MIME header key-value pair right at the beginning. It parses that header and returns it, along with the index at which the next header is expected to start. If you just want to parse a single header, you can ignore the second component of the tuple, which is the index of the next header. Error values are returned if the data could not be successfully interpreted as a MIME key-value pair."],["parse_headers","Parses all the headers from the raw data given. This function takes raw byte data, and starts parsing it, expecting there to be zero or more MIME header key-value pair right at the beginning, followed by two consecutive newlines (i.e. a blank line). It parses those headers and returns them in a vector. The normal vector functions can be used to access the headers linearly, or the MailHeaderMap trait can be used to access them in a map-like fashion. Along with this vector, the function returns the index at which the message body is expected to start. If you just care about the headers, you can ignore the second component of the returned tuple. Error values are returned if there was some sort of parsing error."],["parse_mail","The main mail-parsing entry point. This function takes the raw data making up the message body and returns a structured version of it, which allows easily accessing the header and body information as needed."]],"struct":[["MailHeader","A struct that represents a single header in the message. It holds slices into the raw byte array passed to parse_mail, and so the lifetime of this struct must be contained within the lifetime of the raw input. There are additional accessor functions on this struct to extract the data as Rust strings."],["ParsedContentType","A struct to hold a more structured representation of the Content-Type header. This is provided mostly as a convenience since this metadata is usually needed to interpret the message body properly."],["ParsedMail","Struct that holds the structured representation of the message. Note that since MIME allows for nested multipart messages, a tree-like structure is necessary to represent it properly. This struct accomplishes that by holding a vector of other ParsedMail structures for the subparts."]],"trait":[["MailHeaderMap","A trait that is implemented by the Vec returned by the parse_headers function. It provides a map-like interface to look up header values by their name."]]}); \ No newline at end of file diff --git a/target/doc/mailparse/struct.MailHeader.html b/target/doc/mailparse/struct.MailHeader.html index 56798f4..0313162 100644 --- a/target/doc/mailparse/struct.MailHeader.html +++ b/target/doc/mailparse/struct.MailHeader.html @@ -11,6 +11,7 @@ + @@ -43,10 +44,10 @@

Struct mailparse::MailHeader - - [] - - [src]

+ + [] + + [src]
pub struct MailHeader<'a> {
     // some fields omitted
 }

A struct that represents a single header in the message. @@ -69,7 +70,7 @@ any quoted-printable words in the value are decoded.

let (parsed, _) = parse_header(b"Subject: =?iso-8859-1?Q?=A1Hola,_se=F1or!?=").unwrap(); assert_eq!(parsed.get_key().unwrap(), "Subject"); assert_eq!(parsed.get_value().unwrap(), "\u{a1}Hola, se\u{f1}or!"); -

Trait Implementations

Derived Implementations

impl<'a> Debug for MailHeader<'a>

fn fmt(&self, __arg_0: &mut