#[allow(missing_docs)] #[non_exhaustive]
#[derive(
::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
)]
pub enum Profile {
#[allow(missing_docs)] DvbDash2014,
#[allow(missing_docs)] Hbbtv15,
#[allow(missing_docs)] Hybridcast,
#[allow(missing_docs)] None,
#[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
}
impl ::std::convert::From<&str> for Profile {
fn from(s: &str) -> Self {
match s {
"DVB_DASH_2014" => Profile::DvbDash2014,
"HBBTV_1_5" => Profile::Hbbtv15,
"HYBRIDCAST" => Profile::Hybridcast,
"NONE" => Profile::None,
other => Profile::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
}
}
}
impl ::std::str::FromStr for Profile {
type Err = ::std::convert::Infallible;
fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
::std::result::Result::Ok(Profile::from(s))
}
}
impl Profile {
pub fn as_str(&self) -> &str {
match self {
Profile::DvbDash2014 => "DVB_DASH_2014",
Profile::Hbbtv15 => "HBBTV_1_5",
Profile::Hybridcast => "HYBRIDCAST",
Profile::None => "NONE",
Profile::Unknown(value) => value.as_str(),
}
}
pub const fn values() -> &'static [&'static str] {
&["DVB_DASH_2014", "HBBTV_1_5", "HYBRIDCAST", "NONE"]
}
}
impl ::std::convert::AsRef<str> for Profile {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl Profile {
pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
match Self::from(value) {
#[allow(deprecated)]
Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
known => Ok(known),
}
}
}
impl ::std::fmt::Display for Profile {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
match self {
Profile::DvbDash2014 => write!(f, "DVB_DASH_2014"),
Profile::Hbbtv15 => write!(f, "HBBTV_1_5"),
Profile::Hybridcast => write!(f, "HYBRIDCAST"),
Profile::None => write!(f, "NONE"),
Profile::Unknown(value) => write!(f, "{value}"),
}
}
}