#[doc(alias = "BMM_SCHEMA_METADATA_KEY")]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum BmmSchemaMetadataKey {
BmmVersion,
ModelPublisher,
SchemaName,
ModelRelease,
SchemaRevision,
SchemaLifecycleState,
SchemaDescription,
SchemaPath,
Other(String),
}
impl BmmSchemaMetadataKey {
#[must_use]
pub fn as_str(&self) -> &str {
match self {
Self::BmmVersion => "bmm_version",
Self::ModelPublisher => "model_publisher",
Self::SchemaName => "schema_name",
Self::ModelRelease => "model_release",
Self::SchemaRevision => "schema_revision",
Self::SchemaLifecycleState => "schema_lifecycle_state",
Self::SchemaDescription => "schema_description",
Self::SchemaPath => "schema_path",
Self::Other(__s) => __s.as_str(),
}
}
#[must_use]
pub fn from_wire(__s: &str) -> Self {
match __s {
"bmm_version" => Self::BmmVersion,
"model_publisher" => Self::ModelPublisher,
"schema_name" => Self::SchemaName,
"model_release" => Self::ModelRelease,
"schema_revision" => Self::SchemaRevision,
"schema_lifecycle_state" => Self::SchemaLifecycleState,
"schema_description" => Self::SchemaDescription,
"schema_path" => Self::SchemaPath,
_ => Self::Other(__s.to_owned()),
}
}
}
impl ::core::convert::TryFrom<&str> for BmmSchemaMetadataKey {
type Error = UnknownBmmSchemaMetadataKey;
fn try_from(__s: &str) -> ::core::result::Result<Self, Self::Error> {
match __s {
"bmm_version" => ::core::result::Result::Ok(Self::BmmVersion),
"model_publisher" => ::core::result::Result::Ok(Self::ModelPublisher),
"schema_name" => ::core::result::Result::Ok(Self::SchemaName),
"model_release" => ::core::result::Result::Ok(Self::ModelRelease),
"schema_revision" => ::core::result::Result::Ok(Self::SchemaRevision),
"schema_lifecycle_state" => ::core::result::Result::Ok(Self::SchemaLifecycleState),
"schema_description" => ::core::result::Result::Ok(Self::SchemaDescription),
"schema_path" => ::core::result::Result::Ok(Self::SchemaPath),
_ => ::core::result::Result::Err(UnknownBmmSchemaMetadataKey(__s.to_owned())),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct UnknownBmmSchemaMetadataKey(pub String);
impl ::core::fmt::Display for UnknownBmmSchemaMetadataKey {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
::core::write!(f, "unknown BMM_SCHEMA_METADATA_KEY value: {:?}", self.0)
}
}
impl ::std::error::Error for UnknownBmmSchemaMetadataKey {}