#[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 Status {
#[allow(missing_docs)] Active,
#[allow(missing_docs)] Deleting,
#[allow(missing_docs)] Error,
#[allow(missing_docs)] Standby,
#[allow(missing_docs)] Starting,
#[allow(missing_docs)] Stopping,
#[allow(missing_docs)] Updating,
Unknown(crate::primitives::UnknownVariantValue),
}
impl std::convert::From<&str> for Status {
fn from(s: &str) -> Self {
match s {
"ACTIVE" => Status::Active,
"DELETING" => Status::Deleting,
"ERROR" => Status::Error,
"STANDBY" => Status::Standby,
"STARTING" => Status::Starting,
"STOPPING" => Status::Stopping,
"UPDATING" => Status::Updating,
other => Status::Unknown(crate::primitives::UnknownVariantValue(other.to_owned())),
}
}
}
impl std::str::FromStr for Status {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
Ok(Status::from(s))
}
}
impl Status {
pub fn as_str(&self) -> &str {
match self {
Status::Active => "ACTIVE",
Status::Deleting => "DELETING",
Status::Error => "ERROR",
Status::Standby => "STANDBY",
Status::Starting => "STARTING",
Status::Stopping => "STOPPING",
Status::Updating => "UPDATING",
Status::Unknown(value) => value.as_str(),
}
}
pub const fn values() -> &'static [&'static str] {
&[
"ACTIVE", "DELETING", "ERROR", "STANDBY", "STARTING", "STOPPING", "UPDATING",
]
}
}
impl AsRef<str> for Status {
fn as_ref(&self) -> &str {
self.as_str()
}
}