#[non_exhaustive]pub enum ContentFormat {
MultipartFormData,
UrlEncoded,
}Expand description
A format of request content this crate parses, chosen by the request’s media type.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
MultipartFormData
multipart/form-data, as RFC 7578 defines it.
UrlEncoded
application/x-www-form-urlencoded, as the WHATWG URL Standard defines it.
Implementations§
Source§impl ContentFormat
impl ContentFormat
Sourcepub fn from_media_type(media_type: &MediaType) -> Option<Self>
pub fn from_media_type(media_type: &MediaType) -> Option<Self>
The format of content with this media type, by its essence, or None for a type this crate does not parse.
use base_web_content::ContentFormat;
use base_web_media_type::MediaType;
let media_type = MediaType::parse("multipart/form-data; boundary=x")?;
assert_eq!(ContentFormat::from_media_type(&media_type), Some(ContentFormat::MultipartFormData));
assert_eq!(ContentFormat::from_media_type(&MediaType::APPLICATION_JSON), None);Sourcepub fn media_type(self) -> MediaType
pub fn media_type(self) -> MediaType
The format’s media type, without parameters.
Trait Implementations§
Source§impl Clone for ContentFormat
impl Clone for ContentFormat
impl Copy for ContentFormat
Source§impl Debug for ContentFormat
impl Debug for ContentFormat
impl Eq for ContentFormat
Source§impl Hash for ContentFormat
impl Hash for ContentFormat
Source§impl PartialEq for ContentFormat
impl PartialEq for ContentFormat
impl StructuralPartialEq for ContentFormat
Auto Trait Implementations§
impl Forget for ContentFormat
impl Freeze for ContentFormat
impl RefUnwindSafe for ContentFormat
impl Send for ContentFormat
impl Sync for ContentFormat
impl Unpin for ContentFormat
impl UnsafeUnpin for ContentFormat
impl UnwindSafe for ContentFormat
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