diff --git a/src/error.rs b/src/error.rs index 91cebba..b803bd1 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,9 +1,8 @@ use trackable::error::{ErrorKind as TrackableErrorKind, TrackableError}; /// This crate specific `Error` type. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, TrackableError)] pub struct Error(TrackableError); -derive_traits_for_trackable_error_newtype!(Error, ErrorKind); /// Possible error kinds. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] diff --git a/src/tags/basic.rs b/src/tags/basic.rs index 6d0924c..d79208d 100644 --- a/src/tags/basic.rs +++ b/src/tags/basic.rs @@ -13,7 +13,7 @@ impl ExtM3u { pub(crate) const PREFIX: &'static str = "#EXTM3U"; /// Returns the protocol compatibility version that this tag requires. - pub fn requires_version(&self) -> ProtocolVersion { + pub fn requires_version(self) -> ProtocolVersion { ProtocolVersion::V1 } } @@ -46,12 +46,12 @@ impl ExtXVersion { } /// Returns the protocol compatibility version of the playlist containing this tag. - pub fn version(&self) -> ProtocolVersion { + pub fn version(self) -> ProtocolVersion { self.version } /// Returns the protocol compatibility version that this tag requires. - pub fn requires_version(&self) -> ProtocolVersion { + pub fn requires_version(self) -> ProtocolVersion { ProtocolVersion::V1 } } diff --git a/src/tags/media_or_master_playlist.rs b/src/tags/media_or_master_playlist.rs index 8dc6a7d..661e6f0 100644 --- a/src/tags/media_or_master_playlist.rs +++ b/src/tags/media_or_master_playlist.rs @@ -15,7 +15,7 @@ impl ExtXIndependentSegments { pub(crate) const PREFIX: &'static str = "#EXT-X-INDEPENDENT-SEGMENTS"; /// Returns the protocol compatibility version that this tag requires. - pub fn requires_version(&self) -> ProtocolVersion { + pub fn requires_version(self) -> ProtocolVersion { ProtocolVersion::V1 } } diff --git a/src/tags/media_playlist.rs b/src/tags/media_playlist.rs index d917e99..69ea38c 100644 --- a/src/tags/media_playlist.rs +++ b/src/tags/media_playlist.rs @@ -66,12 +66,12 @@ impl ExtXMediaSequence { } /// Returns the sequence number of the first media segment that appears in the associated playlist. - pub fn seq_num(&self) -> u64 { + pub fn seq_num(self) -> u64 { self.seq_num } /// Returns the protocol compatibility version that this tag requires. - pub fn requires_version(&self) -> ProtocolVersion { + pub fn requires_version(self) -> ProtocolVersion { ProtocolVersion::V1 } } @@ -106,12 +106,12 @@ impl ExtXDiscontinuitySequence { /// Returns the discontinuity sequence number of /// the first media segment that appears in the associated playlist. - pub fn seq_num(&self) -> u64 { + pub fn seq_num(self) -> u64 { self.seq_num } /// Returns the protocol compatibility version that this tag requires. - pub fn requires_version(&self) -> ProtocolVersion { + pub fn requires_version(self) -> ProtocolVersion { ProtocolVersion::V1 } } @@ -138,7 +138,7 @@ impl ExtXEndList { pub(crate) const PREFIX: &'static str = "#EXT-X-ENDLIST"; /// Returns the protocol compatibility version that this tag requires. - pub fn requires_version(&self) -> ProtocolVersion { + pub fn requires_version(self) -> ProtocolVersion { ProtocolVersion::V1 } } @@ -171,12 +171,12 @@ impl ExtXPlaylistType { } /// Returns the type of the associated media playlist. - pub fn playlist_type(&self) -> PlaylistType { + pub fn playlist_type(self) -> PlaylistType { self.playlist_type } /// Returns the protocol compatibility version that this tag requires. - pub fn requires_version(&self) -> ProtocolVersion { + pub fn requires_version(self) -> ProtocolVersion { ProtocolVersion::V1 } } @@ -203,7 +203,7 @@ impl ExtXIFramesOnly { pub(crate) const PREFIX: &'static str = "#EXT-X-I-FRAMES-ONLY"; /// Returns the protocol compatibility version that this tag requires. - pub fn requires_version(&self) -> ProtocolVersion { + pub fn requires_version(self) -> ProtocolVersion { ProtocolVersion::V4 } } diff --git a/src/tags/media_segment.rs b/src/tags/media_segment.rs index d505f01..32b7fb6 100644 --- a/src/tags/media_segment.rs +++ b/src/tags/media_segment.rs @@ -137,7 +137,7 @@ impl ExtXDiscontinuity { pub(crate) const PREFIX: &'static str = "#EXT-X-DISCONTINUITY"; /// Returns the protocol compatibility version that this tag requires. - pub fn requires_version(&self) -> ProtocolVersion { + pub fn requires_version(self) -> ProtocolVersion { ProtocolVersion::V1 } } diff --git a/src/types.rs b/src/types.rs index cf24cfb..0bf8cc6 100644 --- a/src/types.rs +++ b/src/types.rs @@ -150,11 +150,11 @@ impl DecimalFloatingPoint { } /// Converts `DecimalFloatingPoint` to `f64`. - pub fn as_f64(&self) -> f64 { + pub fn as_f64(self) -> f64 { self.0 } - pub(crate) fn to_duration(&self) -> Duration { + pub(crate) fn to_duration(self) -> Duration { let secs = self.0 as u64; let nanos = (self.0.fract() * 1_000_000_000.0) as u32; Duration::new(secs, nanos) @@ -209,7 +209,7 @@ impl SignedDecimalFloatingPoint { } /// Converts `DecimalFloatingPoint` to `f64`. - pub fn as_f64(&self) -> f64 { + pub fn as_f64(self) -> f64 { self.0 } }