pub enum ContentType {
ApplicationJson,
ApplicationXml,
TextPlain,
TextHtml,
FormUrlEncoded,
Unknown,
}Expand description
Supported HTTP content types.
Defines common content types for HTTP communication.
Variants§
ApplicationJson
application/json content type.
For JSON data format.
ApplicationXml
application/xml content type.
For XML data format.
TextPlain
text/plain content type.
For plain text data.
TextHtml
text/html content type.
For HTML documents.
FormUrlEncoded
application/x-www-form-urlencoded content type.
For form data submission.
Unknown
Unknown content type.
For unrecognized content types.
Implementations§
Source§impl ContentType
Implementation for ContentType enum.
impl ContentType
Implementation for ContentType enum.
Sourcepub fn get_body_string<T>(&self, data: &T) -> String
pub fn get_body_string<T>(&self, data: &T) -> String
Sourcepub fn format_content_type_with_charset(
content_type: &str,
charset: &str,
) -> String
pub fn format_content_type_with_charset( content_type: &str, charset: &str, ) -> String
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 Default for ContentType
impl Default for ContentType
Source§fn default() -> ContentType
fn default() -> ContentType
Returns the “default value” for a type. Read more
Source§impl FromStr for ContentType
Implements FromStr for ContentType.
impl FromStr for ContentType
Implements FromStr for ContentType.
Source§impl PartialEq for ContentType
impl PartialEq 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