mirror of
https://github.com/sile/hls_m3u8.git
synced 2024-11-29 02:00:59 +00:00
removed Eq implementation
f64 and f32 don't implement Eq for a reason! For example this comparison `1.0 + 2.0 == 3.0` is false for floats, even though it should be true!
This commit is contained in:
parent
99493446eb
commit
8d1ed6372b
7 changed files with 10 additions and 12 deletions
|
@ -79,14 +79,14 @@ impl DerefMut for Lines {
|
|||
fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 }
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Line {
|
||||
Tag(Tag),
|
||||
Uri(String),
|
||||
}
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Tag {
|
||||
ExtM3u(tags::ExtM3u),
|
||||
ExtXVersion(tags::ExtXVersion),
|
||||
|
|
|
@ -21,7 +21,7 @@ use crate::{Error, RequiredVersion};
|
|||
/// Renditions SHOULD play this Rendition.
|
||||
///
|
||||
/// [4.3.4.2. EXT-X-STREAM-INF]: https://tools.ietf.org/html/rfc8216#section-4.3.4.2
|
||||
#[derive(PartialOrd, Debug, Clone, PartialEq, Eq)]
|
||||
#[derive(PartialOrd, Debug, Clone, PartialEq)]
|
||||
pub struct ExtXStreamInf {
|
||||
uri: String,
|
||||
frame_rate: Option<DecimalFloatingPoint>,
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::{Error, RequiredVersion};
|
|||
/// [4.3.5.2. EXT-X-START]
|
||||
///
|
||||
/// [4.3.5.2. EXT-X-START]: https://tools.ietf.org/html/rfc8216#section-4.3.5.2
|
||||
#[derive(PartialOrd, Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(PartialOrd, Debug, Clone, Copy, PartialEq)]
|
||||
pub struct ExtXStart {
|
||||
time_offset: SignedDecimalFloatingPoint,
|
||||
precise: bool,
|
||||
|
|
|
@ -35,8 +35,6 @@ impl DecimalFloatingPoint {
|
|||
pub const fn as_f64(self) -> f64 { self.0 }
|
||||
}
|
||||
|
||||
impl Eq for DecimalFloatingPoint {}
|
||||
|
||||
// this trait is implemented manually, so it doesn't construct a
|
||||
// [`DecimalFloatingPoint`], with a negative value.
|
||||
impl FromStr for DecimalFloatingPoint {
|
||||
|
|
|
@ -31,6 +31,7 @@ impl fmt::Display for KeyFormat {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", quote("identity")) }
|
||||
}
|
||||
|
||||
/// This tag requires [`ProtocolVersion::V5`].
|
||||
impl RequiredVersion for KeyFormat {
|
||||
fn required_version(&self) -> ProtocolVersion { ProtocolVersion::V5 }
|
||||
}
|
||||
|
|
|
@ -15,10 +15,6 @@ use crate::RequiredVersion;
|
|||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
|
||||
pub struct KeyFormatVersions(Vec<usize>);
|
||||
|
||||
impl Default for KeyFormatVersions {
|
||||
fn default() -> Self { Self(vec![1]) }
|
||||
}
|
||||
|
||||
impl KeyFormatVersions {
|
||||
/// Makes a new [`KeyFormatVersions`].
|
||||
pub fn new() -> Self { Self::default() }
|
||||
|
@ -37,6 +33,10 @@ impl KeyFormatVersions {
|
|||
pub fn is_default(&self) -> bool { self.0 == vec![1] && self.0.len() == 1 || self.0.is_empty() }
|
||||
}
|
||||
|
||||
impl Default for KeyFormatVersions {
|
||||
fn default() -> Self { Self(vec![1]) }
|
||||
}
|
||||
|
||||
impl Deref for KeyFormatVersions {
|
||||
type Target = Vec<usize>;
|
||||
|
||||
|
@ -47,6 +47,7 @@ impl DerefMut for KeyFormatVersions {
|
|||
fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 }
|
||||
}
|
||||
|
||||
/// This tag requires [`ProtocolVersion::V5`].
|
||||
impl RequiredVersion for KeyFormatVersions {
|
||||
fn required_version(&self) -> ProtocolVersion { ProtocolVersion::V5 }
|
||||
}
|
||||
|
|
|
@ -33,8 +33,6 @@ impl Deref for SignedDecimalFloatingPoint {
|
|||
fn deref(&self) -> &Self::Target { &self.0 }
|
||||
}
|
||||
|
||||
impl Eq for SignedDecimalFloatingPoint {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Reference in a new issue