Struct webmachine_rust::content_negotiation::MediaType
source · pub struct MediaType {
pub main: String,
pub sub: String,
pub weight: f32,
}Expand description
Struct to represent a media type
Fields§
§main: StringMain type of the media type
sub: StringSub type of the media type
weight: f32Weight associated with the media type
Implementations§
source§impl MediaType
impl MediaType
sourcepub fn parse_string(media_type: &str) -> MediaType
pub fn parse_string(media_type: &str) -> MediaType
Parse a string into a MediaType struct
sourcepub fn with_weight(&self, weight: &String) -> MediaType
pub fn with_weight(&self, weight: &String) -> MediaType
Adds a quality weight to the media type
sourcepub fn matches(&self, other: &MediaType) -> MediaTypeMatch
pub fn matches(&self, other: &MediaType) -> MediaTypeMatch
If this media type matches the other media type
Trait Implementations§
source§impl PartialEq<MediaType> for MediaType
impl PartialEq<MediaType> for MediaType
impl StructuralPartialEq for MediaType
Auto Trait Implementations§
impl RefUnwindSafe for MediaType
impl Send for MediaType
impl Sync for MediaType
impl Unpin for MediaType
impl UnwindSafe for MediaType
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