1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! This crate provides two MediaType structs: [`MediaType`] and [`MediaTypeBuf`].
//!
//! - [`MediaType`] does not copy data during parsing
//!     and just holds reference to the original string. It is also const-constructible.
//! - [`MediaTypeBuf`] is an owned  and immutable version of [`MediaType`].
//!
//! [`MadiaType`]: ./struct.MediaType.html
//! [`MediaTypeBuf`]: ./struct.MediaTypeBuf.html
//!
//!  ```
//! use mediatype::{names::*, MediaType, MediaTypeBuf};
//!
//! const TEXT_PLAIN: MediaType = MediaType::new(TEXT, PLAIN);
//! let text_plain: MediaTypeBuf = "text/plain".parse().unwrap();
//!
//! assert_eq!(text_plain, TEXT_PLAIN);
//!
//! match (text_plain.ty(), text_plain.subty()) {
//!     ("text", "plain") => println!("plain text!"),
//!     ("text", _) => println!("structured text"),
//!     _ => println!("not text"),
//! }
//! ```

#![forbid(unsafe_code)]
#![forbid(clippy::all)]
#![cfg_attr(docsrs, feature(doc_cfg))]

mod consts;
mod error;
mod media_type;
mod media_type_buf;
mod name;
mod params;
mod parse;
mod serde;
mod value;

pub use consts::*;
pub use error::*;
pub use media_type::*;
pub use media_type_buf::*;
pub use name::*;
pub use params::*;
pub use value::*;