Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions mime-parse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ pub struct Parser {
can_range: bool,
}

#[derive(Clone)]
#[derive(Clone, Eq, PartialEq)]
pub struct Mime {
source: Source,
slash: u16,
plus: Option<u16>,
params: ParamSource,
}

#[derive(Clone)]
#[derive(Clone, Eq, PartialEq)]
pub enum Source {
Atom(u8, &'static str),
Dynamic(String),
Expand All @@ -41,7 +41,7 @@ impl AsRef<str> for Source {
type Indexed = (u16, u16);
type IndexedPair = (Indexed, Indexed);

#[derive(Clone)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum ParamSource {
None,
Utf8(u16),
Expand All @@ -50,12 +50,13 @@ pub enum ParamSource {
Custom(u16, Vec<IndexedPair>),
}

#[derive(Debug, Eq, PartialEq)]
pub enum InternParams {
Utf8(usize),
None,
}

#[derive(Debug)]
#[derive(Debug, Eq, PartialEq)]
pub enum ParseError {
MissingSlash,
MissingEqual,
Expand All @@ -68,7 +69,7 @@ pub enum ParseError {
TooLong,
}

#[derive(Clone, Copy)]
#[derive(Clone, Copy, Eq, PartialEq)]
pub struct Byte(u8);

impl fmt::Debug for Byte {
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::fmt;
use mime_parse::ParseError;

/// An error type representing an invalid `MediaType` or `MediaRange`.
#[derive(Debug)]
#[derive(Debug, Eq, PartialEq)]
pub struct InvalidMime {
pub(crate) inner: ParseError,
}
Expand Down
2 changes: 2 additions & 0 deletions src/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ impl PartialEq<MediaRange> for str {
}
}

impl Eq for MediaRange {}

impl FromStr for MediaRange {
type Err = InvalidMime;

Expand Down
2 changes: 2 additions & 0 deletions src/type_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ impl PartialEq<MediaType> for str {
}
}

impl Eq for MediaType {}

impl FromStr for MediaType {
type Err = InvalidMime;

Expand Down
2 changes: 2 additions & 0 deletions src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ impl<'a> PartialEq<Value<'a>> for str {
}
}

impl<'a> Eq for Value<'a> {}

impl<'a> From<Value<'a>> for Cow<'a, str> {
#[inline]
fn from(value: Value<'a>) -> Self {
Expand Down