From 70d178c98e253294be9fc77a4ac268dd7dd6dfaa Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Sun, 4 Dec 2016 22:53:00 -0500 Subject: Update documentation --- target/doc/src/mailparse/src/lib.rs.html | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'target/doc/src/mailparse') diff --git a/target/doc/src/mailparse/src/lib.rs.html b/target/doc/src/mailparse/src/lib.rs.html index 104a734..7a8b65f 100644 --- a/target/doc/src/mailparse/src/lib.rs.html +++ b/target/doc/src/mailparse/src/lib.rs.html @@ -1021,6 +1021,11 @@ 977 978 979 +980 +981 +982 +983 +984
 extern crate base64;
 extern crate encoding;
@@ -1471,7 +1476,9 @@
     let mut headers: Vec<MailHeader> = Vec::new();
     let mut ix = 0;
     loop {
-        if raw_data[ix] == b'\n' {
+        if ix >= raw_data.len() {
+            break;
+        } else if raw_data[ix] == b'\n' {
             ix = ix + 1;
             break;
         } else if raw_data[ix] == b'\r' {
@@ -1486,9 +1493,6 @@
         let (header, ix_next) = try!(parse_header(&raw_data[ix..]));
         headers.push(header);
         ix = ix + ix_next;
-        if ix >= raw_data.len() {
-            break;
-        }
     }
     Ok((headers, ix))
 }
@@ -2000,6 +2004,12 @@
         assert_eq!(mail.subparts[0].ctype.mimetype, "text/plain");
         assert_eq!(mail.subparts[0].get_body().unwrap(), "");
     }
+
+    #[test]
+    fn test_empty() {
+        let mail = parse_mail("".as_bytes()).unwrap();
+        assert_eq!(mail.get_body().unwrap(), "");
+    }
 }
 
-- cgit v1.2.3