From 42469275d34b5d32355f86bd087270f125451620 Mon Sep 17 00:00:00 2001 From: Luro02 <24826124+Luro02@users.noreply.github.com> Date: Sun, 15 Sep 2019 18:54:25 +0200 Subject: [PATCH] internalize decimal_floating_point #9 --- src/tags/master_playlist/stream_inf.rs | 4 ++-- src/types/decimal_floating_point.rs | 4 ++-- src/types/mod.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tags/master_playlist/stream_inf.rs b/src/tags/master_playlist/stream_inf.rs index 78dd7ee..808d4fc 100644 --- a/src/tags/master_playlist/stream_inf.rs +++ b/src/tags/master_playlist/stream_inf.rs @@ -79,8 +79,8 @@ impl ExtXStreamInf { } /// Returns the maximum frame rate for all the video in the variant stream. - pub const fn frame_rate(&self) -> Option { - self.frame_rate + pub fn frame_rate(&self) -> Option { + self.frame_rate.map_or(None, |v| Some(v.as_f64())) } /// Returns the HDCP level of the variant stream. diff --git a/src/types/decimal_floating_point.rs b/src/types/decimal_floating_point.rs index b044cc4..a829129 100644 --- a/src/types/decimal_floating_point.rs +++ b/src/types/decimal_floating_point.rs @@ -10,7 +10,7 @@ use crate::Error; /// /// [4.2. Attribute Lists]: https://tools.ietf.org/html/rfc8216#section-4.2 #[derive(Debug, Clone, Copy, PartialEq, PartialOrd)] -pub struct DecimalFloatingPoint(f64); +pub(crate) struct DecimalFloatingPoint(f64); impl DecimalFloatingPoint { /// Makes a new `DecimalFloatingPoint` instance. @@ -66,7 +66,7 @@ impl FromStr for DecimalFloatingPoint { return Err(Error::invalid_input()); } let n = input.parse()?; - Ok(DecimalFloatingPoint(n)) + DecimalFloatingPoint::new(n) } } diff --git a/src/types/mod.rs b/src/types/mod.rs index 83390b7..10641d3 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -14,7 +14,7 @@ mod signed_decimal_floating_point; pub use byte_range::*; pub use closed_captions::*; -pub use decimal_floating_point::*; +pub(crate) use decimal_floating_point::*; pub(crate) use decimal_resolution::*; pub use encryption_method::*; pub use hdcp_level::*;