Expand description
Relatively näive Pest based parser, picking out “contacts”
from email address lists found in headers such as from
, to
, cc
, etc.
This library aims to be practical rather than “correct”. It is (potentially excessively) permissive to parse even the worst garbage in anyone’s inbox. Limited testing with real world data has been, but the grammar that forms the basis for this library probably still needs work to catch more edge cases.
§Example
use email_address_list::*;
let manual: AddressList = vec![
Contact::new("ríomhphost@example.org").set_name("Túsainm Sloinne"),
Contact::new("sampla@example.org")
].into();
let result = parse_address_list(
"Túsainm Sloinne <ríomhphost@example.org>, sampla@example.org"
).unwrap();
assert!(result.deep_eq(&manual));
Modules§
Structs§
- Contacts
- Container for
Contact
s - Email
Contact - A contact with at least an email address
- Garbage
Contact - A string that we couldn’t parse into an
EmailContact
but implements theContactish
trait regardless - Group
- A group with a name and
Contacts
Enums§
- Address
List - All forms which email headers like
To
,From
,Cc
, etc. can take - Contact
- Either an
EmailContact
we could successfully parse or aGarbageContact
we didn’t want to throw away
Traits§
- Contactish
- Unified interface for all contact types
- Contactsish
- For everything that has contacts
- DeepEq
- Check if all fields are the same rather than just a subset (“deep equals”)
Functions§
- parse_
address_ list - Get an
AddressList
from a string - parse_
contact - Parse only a single
Contact
, ignore the rest