#[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 Protocol {
#[allow(missing_docs)] Cdi,
#[allow(missing_docs)] FujitsuQos,
#[allow(missing_docs)] Rist,
#[allow(missing_docs)] Rtp,
#[allow(missing_docs)] RtpFec,
#[allow(missing_docs)] SrtCaller,
#[allow(missing_docs)] SrtListener,
#[allow(missing_docs)] St2110Jpegxs,
#[allow(missing_docs)] ZixiPull,
#[allow(missing_docs)] ZixiPush,
Unknown(crate::primitives::UnknownVariantValue),
}
impl std::convert::From<&str> for Protocol {
fn from(s: &str) -> Self {
match s {
"cdi" => Protocol::Cdi,
"fujitsu-qos" => Protocol::FujitsuQos,
"rist" => Protocol::Rist,
"rtp" => Protocol::Rtp,
"rtp-fec" => Protocol::RtpFec,
"srt-caller" => Protocol::SrtCaller,
"srt-listener" => Protocol::SrtListener,
"st2110-jpegxs" => Protocol::St2110Jpegxs,
"zixi-pull" => Protocol::ZixiPull,
"zixi-push" => Protocol::ZixiPush,
other => Protocol::Unknown(crate::primitives::UnknownVariantValue(other.to_owned())),
}
}
}
impl std::str::FromStr for Protocol {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
Ok(Protocol::from(s))
}
}
impl Protocol {
pub fn as_str(&self) -> &str {
match self {
Protocol::Cdi => "cdi",
Protocol::FujitsuQos => "fujitsu-qos",
Protocol::Rist => "rist",
Protocol::Rtp => "rtp",
Protocol::RtpFec => "rtp-fec",
Protocol::SrtCaller => "srt-caller",
Protocol::SrtListener => "srt-listener",
Protocol::St2110Jpegxs => "st2110-jpegxs",
Protocol::ZixiPull => "zixi-pull",
Protocol::ZixiPush => "zixi-push",
Protocol::Unknown(value) => value.as_str(),
}
}
pub const fn values() -> &'static [&'static str] {
&[
"cdi",
"fujitsu-qos",
"rist",
"rtp",
"rtp-fec",
"srt-caller",
"srt-listener",
"st2110-jpegxs",
"zixi-pull",
"zixi-push",
]
}
}
impl AsRef<str> for Protocol {
fn as_ref(&self) -> &str {
self.as_str()
}
}