pub enum ContentType {
Application(Application),
Audio(Audio),
Chemical(Chemical),
Font(Font),
Image(Image),
Message(Message),
Model(Model),
Multipart(Multipart),
Text(Text),
Video(Video),
Custom(String),
}Variants§
Application(Application)
Audio(Audio)
Chemical(Chemical)
Font(Font)
Image(Image)
Message(Message)
Model(Model)
Multipart(Multipart)
Text(Text)
Video(Video)
Custom(String)
Implementations§
Source§impl ContentType
impl ContentType
pub fn as_str(&self) -> &str
pub fn as_header_value(&self) -> HeaderValue
pub fn to_header_value(self) -> HeaderValue
pub fn from_header_value(value: &HeaderValue) -> Result<Self, ContentTypeError>
pub fn extract_charset(content_type: &str) -> Option<&str>
pub fn extract_boundary(content_type: &str) -> Option<&str>
pub fn matches_with_params(content_type: &str, expected: Self) -> bool
pub fn from_extension(ext: &str) -> Option<Self>
pub fn from_path<P: AsRef<Path>>(path: P) -> Option<Self>
pub fn from_filename(filename: &str) -> Option<Self>
pub fn is_extension_supported(ext: &str) -> bool
pub const fn is_text(&self) -> bool
pub const fn is_image(&self) -> bool
pub const fn is_media(&self) -> bool
pub const fn is_multipart(&self) -> bool
pub fn set_on_headers(self, headers: &mut HeaderMap)
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContentType
impl Debug for ContentType
Source§impl Display for ContentType
impl Display for ContentType
Source§impl From<ContentType> for HeaderValue
impl From<ContentType> for HeaderValue
Source§fn from(value: ContentType) -> Self
fn from(value: ContentType) -> Self
Converts to this type from the input type.
Source§impl From<ContentType> for String
impl From<ContentType> for String
Source§fn from(value: ContentType) -> Self
fn from(value: ContentType) -> Self
Converts to this type from the input type.
Source§impl FromStr for ContentType
impl FromStr for ContentType
Source§impl Hash for ContentType
impl Hash for ContentType
Source§impl PartialEq<ContentType> for Application
impl PartialEq<ContentType> for Application
Source§impl PartialEq<ContentType> for Audio
impl PartialEq<ContentType> for Audio
Source§impl PartialEq<ContentType> for Chemical
impl PartialEq<ContentType> for Chemical
Source§impl PartialEq<ContentType> for Font
impl PartialEq<ContentType> for Font
Source§impl PartialEq<ContentType> for Image
impl PartialEq<ContentType> for Image
Source§impl PartialEq<ContentType> for Message
impl PartialEq<ContentType> for Message
Source§impl PartialEq<ContentType> for Model
impl PartialEq<ContentType> for Model
Source§impl PartialEq<ContentType> for Multipart
impl PartialEq<ContentType> for Multipart
Source§impl PartialEq<ContentType> for Text
impl PartialEq<ContentType> for Text
Source§impl PartialEq<ContentType> for Video
impl PartialEq<ContentType> for Video
Source§impl<T> PartialEq<T> for ContentType
impl<T> PartialEq<T> for ContentType
Source§impl PartialEq for ContentType
impl PartialEq for ContentType
Source§impl TryFrom<&HeaderValue> for ContentType
impl TryFrom<&HeaderValue> for ContentType
Source§type Error = ContentTypeError
type Error = ContentTypeError
The type returned in the event of a conversion error.
Source§impl TryFrom<&str> for ContentType
impl TryFrom<&str> for ContentType
Source§impl TryFrom<String> for ContentType
impl TryFrom<String> for ContentType
impl Eq for ContentType
impl StructuralPartialEq for ContentType
Auto Trait Implementations§
impl Freeze for ContentType
impl RefUnwindSafe for ContentType
impl Send for ContentType
impl Sync for ContentType
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.