diff --git a/.travis.yml b/.travis.yml index 3c0d571..c195b3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,17 +7,13 @@ matrix: - rust: stable - rust: beta - rust: nightly + - rust: 1.15.0 sudo: false dist: trusty +cache: cargo -cache: - apt: true - directories: - - target/debug/deps - - target/debug/build - -notifications: - email: false - - +script: + - cargo build + - cargo test + - rustdoc --test README.md -L target/debug/deps diff --git a/README.md b/README.md index f450b04..dba6314 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,24 @@ Support MIME (Media Types) as strong types in Rust. [Documentation](https://docs.rs/mime) +## Usage +```rust +extern crate mime; + +// common types are constants +let text = mime::TEXT_PLAIN; + +// deconstruct Mimes to match on them +match (text.type_(), text.subtype()) { + (mime::TEXT, mime::PLAIN) => { + // plain text! + }, + (mime::TEXT, _) => { + // structured text! + }, + _ => { + // not text! + } +} +```