summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 999e89f..09710f3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -10,9 +10,17 @@ pub struct MailParseError {
position: usize,
}
-pub fn parse_header(raw_data : &str) -> Result<MailHeader, MailParseError> {
- let ix = raw_data.find(':').ok_or(MailParseError { description: "No ':' found in header".to_string(), position: raw_data.len() });
- return ix.map(|ix| MailHeader { name: &raw_data[0..ix], value: &raw_data[ix + 1 ..] });
+pub fn parse_header(raw_data: &str) -> Result<MailHeader, MailParseError> {
+ let ix = raw_data.find(':').ok_or(MailParseError {
+ description: "No ':' found in header".to_string(),
+ position: raw_data.len(),
+ });
+ return ix.map(|ix| {
+ MailHeader {
+ name: &raw_data[0..ix],
+ value: &raw_data[ix + 1..],
+ }
+ });
}
#[cfg(test)]