Struct trillium_http_types::content::ContentType [−][src]
pub struct ContentType { /* fields omitted */ }Expand description
Indicate the media type of a resource’s content.
Specifications
Examples
use http_types::content::ContentType; use http_types::{headers::Header, Response}; use http_types::mime::Mime; use std::str::FromStr; let content_type = ContentType::new("text/*"); let mut res = Response::new(200); res.insert_header(&content_type, &content_type); let content_type = ContentType::from_headers(res)?.unwrap(); assert_eq!(content_type.header_value(), format!("{}", Mime::from_str("text/*")?).as_str());
Implementations
Create a new instance.
Create a new instance from headers.
Content-Type headers can provide both full and partial URLs. In
order to always return fully qualified URLs, a base URL must be passed to
reference the current environment. In HTTP/1.1 and above this value can
always be determined from the request.
Trait Implementations
Access the header’s name.
Access the header’s value.
Auto Trait Implementations
impl RefUnwindSafe for ContentTypeimpl Send for ContentTypeimpl Sync for ContentTypeimpl Unpin for ContentTypeimpl UnwindSafe for ContentType