diff --git a/src/error.rs b/src/error.rs index 4a7f48d..51c01a0 100644 --- a/src/error.rs +++ b/src/error.rs @@ -210,3 +210,13 @@ impl From<::strum::ParseError> for Error { Error::custom(value) // TODO! } } + +impl From for Error { + fn from(value: String) -> Self { Error::custom(value) } +} + +impl From<::core::convert::Infallible> for Error { + fn from(_: ::core::convert::Infallible) -> Self { + Error::custom("An Infallible error has been returned! (this should never happen!)") + } +} diff --git a/src/master_playlist.rs b/src/master_playlist.rs index 7a5e2c5..7ba57bc 100644 --- a/src/master_playlist.rs +++ b/src/master_playlist.rs @@ -17,7 +17,6 @@ use crate::{Error, RequiredVersion}; #[builder(setter(into, strip_option))] /// Master playlist. pub struct MasterPlaylist { - //#[builder(default, setter(name = "version"))] #[builder(default, setter(skip))] version_tag: ExtXVersion, #[builder(default)] diff --git a/src/types/closed_captions.rs b/src/types/closed_captions.rs index b3425a4..2c73a99 100644 --- a/src/types/closed_captions.rs +++ b/src/types/closed_captions.rs @@ -1,8 +1,8 @@ +use core::convert::Infallible; use std::fmt; use std::str::FromStr; use crate::utils::{quote, unquote}; -use crate::Error; /// The identifier of a closed captions group or its absence. /// @@ -26,7 +26,7 @@ impl fmt::Display for ClosedCaptions { } impl FromStr for ClosedCaptions { - type Err = Error; + type Err = Infallible; fn from_str(input: &str) -> Result { if input.trim() == "NONE" { diff --git a/src/types/key_format_versions.rs b/src/types/key_format_versions.rs index 91bc413..4c33031 100644 --- a/src/types/key_format_versions.rs +++ b/src/types/key_format_versions.rs @@ -1,10 +1,11 @@ +use std::convert::Infallible; use std::fmt; use std::ops::{Deref, DerefMut}; use std::str::FromStr; use crate::types::ProtocolVersion; use crate::utils::{quote, unquote}; -use crate::{Error, RequiredVersion}; +use crate::RequiredVersion; /// A list of [usize], that can be used to indicate which version(s) /// this instance complies with, if more than one version of a particular @@ -51,7 +52,7 @@ impl RequiredVersion for KeyFormatVersions { } impl FromStr for KeyFormatVersions { - type Err = Error; + type Err = Infallible; fn from_str(input: &str) -> Result { let mut result = unquote(input)