pub struct ContentType<'x> {
pub c_type: Cow<'x, str>,
pub attributes: Vec<(Cow<'x, str>, Cow<'x, str>)>,
}Expand description
MIME Content-Type or Content-Disposition header
Fields§
§c_type: Cow<'x, str>§attributes: Vec<(Cow<'x, str>, Cow<'x, str>)>Implementations§
Source§impl<'x> ContentType<'x>
impl<'x> ContentType<'x>
Sourcepub fn new(c_type: impl Into<Cow<'x, str>>) -> Self
pub fn new(c_type: impl Into<Cow<'x, str>>) -> Self
Create a new Content-Type or Content-Disposition header
Sourcepub fn attribute(
self,
key: impl Into<Cow<'x, str>>,
value: impl Into<Cow<'x, str>>,
) -> Self
pub fn attribute( self, key: impl Into<Cow<'x, str>>, value: impl Into<Cow<'x, str>>, ) -> Self
Set a Content-Type / Content-Disposition attribute
Sourcepub fn is_attachment(&self) -> bool
pub fn is_attachment(&self) -> bool
Returns true when the part is an attachment
Trait Implementations§
Source§impl<'x> Clone for ContentType<'x>
impl<'x> Clone for ContentType<'x>
Source§fn clone(&self) -> ContentType<'x>
fn clone(&self) -> ContentType<'x>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'x> Debug for ContentType<'x>
impl<'x> Debug for ContentType<'x>
Source§impl<'x> From<&'x String> for ContentType<'x>
impl<'x> From<&'x String> for ContentType<'x>
Source§impl<'x> From<&'x str> for ContentType<'x>
impl<'x> From<&'x str> for ContentType<'x>
Source§impl<'x> From<ContentType<'x>> for HeaderType<'x>
impl<'x> From<ContentType<'x>> for HeaderType<'x>
Source§fn from(value: ContentType<'x>) -> Self
fn from(value: ContentType<'x>) -> Self
Converts to this type from the input type.
Source§impl From<String> for ContentType<'_>
impl From<String> for ContentType<'_>
Source§impl Header for ContentType<'_>
impl Header for ContentType<'_>
Source§impl<'x> Ord for ContentType<'x>
impl<'x> Ord for ContentType<'x>
Source§fn cmp(&self, other: &ContentType<'x>) -> Ordering
fn cmp(&self, other: &ContentType<'x>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'x> PartialEq for ContentType<'x>
impl<'x> PartialEq for ContentType<'x>
Source§impl<'x> PartialOrd for ContentType<'x>
impl<'x> PartialOrd for ContentType<'x>
impl<'x> Eq for ContentType<'x>
impl<'x> StructuralPartialEq for ContentType<'x>
Auto Trait Implementations§
impl<'x> Freeze for ContentType<'x>
impl<'x> RefUnwindSafe for ContentType<'x>
impl<'x> Send for ContentType<'x>
impl<'x> Sync for ContentType<'x>
impl<'x> Unpin for ContentType<'x>
impl<'x> UnwindSafe for ContentType<'x>
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