pub struct ContentType<'p> { /* private fields */ }Expand description
A part’s declared Content-Type, already checked. A hint: the client
chose it.
§Examples
let ct = mp.file("f").unwrap().content_type().unwrap();
assert!(ct.is("image", "png"));
assert_eq!((ct.type_(), ct.subtype()), ("Image", "PNG"));
assert_eq!(ct.parameter("Q"), Some(&b"x y"[..]));Implementations§
Source§impl<'p> ContentType<'p>
impl<'p> ContentType<'p>
Sourcepub fn is(&self, type_: &str, subtype: &str) -> bool
pub fn is(&self, type_: &str, subtype: &str) -> bool
Whether the type and subtype are these, ASCII case-insensitively.
Trait Implementations§
Source§impl<'p> Clone for ContentType<'p>
impl<'p> Clone for ContentType<'p>
impl<'p> Copy for ContentType<'p>
Auto Trait Implementations§
impl<'p> Freeze for ContentType<'p>
impl<'p> RefUnwindSafe for ContentType<'p>
impl<'p> Send for ContentType<'p>
impl<'p> Sync for ContentType<'p>
impl<'p> Unpin for ContentType<'p>
impl<'p> UnsafeUnpin for ContentType<'p>
impl<'p> UnwindSafe for ContentType<'p>
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