mail-chars [](https://crates.io/crates/mail-chars) [](https://docs.rs/mail-chars) [](https://opensource.org/licenses/Apache-2.0) [](https://travis-ci.org/1aim/mail-chars)
=============
provides lookup table based char classification for mail related grammar parts / charset
I.e. if a given char is valid in atext, ctext, dtext, token etc.
Note that this just covers grammar parts defining sets of chars (like atext, ctext, ...)
but not contextual parts like e.g. quoted-pairs.
```rust
extern crate mail_chars;
use mail_chars::{Charset, rfc5322, rfc2045, CharMatchExt};
fn main() {
assert!(Charset::AText.contains('d'));
assert!('d'.is(Charset::AText));
assert!('d'.is(rfc5322::AText));
// rfc*::* are just reexports grouped by rfc
assert_eq!(Charset::Token, rfc2045::Token);
// if we want to test for more than on char set we can use lookup
let res = Charset::lookup('.');
// has the benefit that there is a is_ascii method
assert!(res.is_ascii());
assert!(res.is(rfc2045::Token));
assert!(res.is(rfc5322::CText));
assert!(!res.is(rfc5322::AText));
}
```
License
=======
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
Contribution
------------
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall
be dual licensed as above, without any additional terms or conditions.