pub struct MediaType { /* private fields */ }Expand description
A media type in its normal form: the type, subtype and parameter names in
lowercase, and each parameter’s value as written once unquoted. Its text
is fmt::Display.
Implementations§
Source§impl MediaType
impl MediaType
Sourcepub fn parse(text: &str) -> Option<MediaType>
pub fn parse(text: &str) -> Option<MediaType>
The media type text spells, or None when it spells none:
type "/" subtype *( OWS ";" OWS [ parameter ] ), in ASCII.
let media = flow_abi::MediaType::parse("Text/HTML ; Charset=\"utf-8\"").unwrap();
assert_eq!(media.to_string(), "text/html;charset=utf-8");Trait Implementations§
impl Eq for MediaType
Source§impl Shaped for MediaType
impl Shaped for MediaType
Source§fn write_at(
&self,
out: &mut ValueWriter<'_, '_>,
ty: &Type,
) -> Result<(), EncodeError>
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
Source§fn read_at(
input: &mut ValueReader<'_, '_, '_>,
ty: &Type,
) -> Result<MediaType, DecodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<MediaType, DecodeError>
impl StructuralPartialEq for MediaType
Auto Trait Implementations§
impl Forget for MediaType
impl Freeze for MediaType
impl Move for MediaType
impl RefUnwindSafe for MediaType
impl Send for MediaTypewhere
RawVecInner: Send,
impl Sync for MediaTypewhere
RawVecInner: Sync,
impl Unpin for MediaType
impl UnsafeUnpin for MediaTypewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<(String, String)>: UnsafeUnpin,
impl UnwindSafe for MediaTypewhere
RawVecInner: UnwindSafe,
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