pub struct ContentType {
pub type_: String,
pub subtype: String,
pub params: HashMap<String, String>,
}Expand description
Parsed Content-Type: header value.
Fields§
§type_: StringTop-level type (“text”, “multipart”, “application”, …), lowercased.
subtype: StringSubtype (“plain”, “html”, “alternative”, “mixed”, “calendar”, …), lowercased.
params: HashMap<String, String>Lowercased parameter map (boundary, charset, name, …).
Values are RFC 2231-decoded when the on-wire shape was
name*=charset''pct-encoded.
Implementations§
Source§impl ContentType
impl ContentType
Sourcepub fn default_for_missing_header() -> Self
pub fn default_for_missing_header() -> Self
Default per RFC 2045 §5.2 when no Content-Type is present:
text/plain; charset=us-ascii.
Sourcepub fn parse(value: &str) -> Self
pub fn parse(value: &str) -> Self
Parse from raw header value (e.g. multipart/mixed; boundary="xyz").
Sourcepub fn is_multipart(&self) -> bool
pub fn is_multipart(&self) -> bool
true if this is a multipart/* type.
Sourcepub fn boundary(&self) -> Option<&str>
pub fn boundary(&self) -> Option<&str>
boundary= parameter for multipart parts. None for non-multipart
or malformed multipart.
Trait Implementations§
Source§impl Clone for ContentType
impl Clone for ContentType
Source§fn clone(&self) -> ContentType
fn clone(&self) -> ContentType
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ContentType
impl RefUnwindSafe for ContentType
impl Send for ContentType
impl Sync for ContentType
impl Unpin for ContentType
impl UnsafeUnpin for ContentType
impl UnwindSafe for ContentType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more