#[doc(alias = "VIEW_STATUS")]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ViewStatus {
Active,
Inactive,
Other(String),
}
impl ViewStatus {
#[must_use]
pub fn as_str(&self) -> &str {
match self {
Self::Active => "active",
Self::Inactive => "inactive",
Self::Other(__s) => __s.as_str(),
}
}
#[must_use]
pub fn from_wire(__s: &str) -> Self {
match __s {
"active" => Self::Active,
"inactive" => Self::Inactive,
_ => Self::Other(__s.to_owned()),
}
}
}
impl ::core::convert::TryFrom<&str> for ViewStatus {
type Error = UnknownViewStatus;
fn try_from(__s: &str) -> ::core::result::Result<Self, Self::Error> {
match __s {
"active" => ::core::result::Result::Ok(Self::Active),
"inactive" => ::core::result::Result::Ok(Self::Inactive),
_ => ::core::result::Result::Err(UnknownViewStatus(__s.to_owned())),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct UnknownViewStatus(pub String);
impl ::core::fmt::Display for UnknownViewStatus {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
::core::write!(f, "unknown VIEW_STATUS value: {:?}", self.0)
}
}
impl ::std::error::Error for UnknownViewStatus {}