mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
33 lines
734 B
Rust
33 lines
734 B
Rust
use std::{
|
|
fmt::{self, Display, Formatter},
|
|
str::FromStr,
|
|
};
|
|
|
|
use azalea_buf::AzBuf;
|
|
|
|
#[derive(Clone, Copy, Debug, AzBuf)]
|
|
pub enum ObjectiveCriteria {
|
|
Integer,
|
|
Hearts,
|
|
}
|
|
|
|
impl Display for ObjectiveCriteria {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
|
match self {
|
|
ObjectiveCriteria::Integer => write!(f, "integer"),
|
|
ObjectiveCriteria::Hearts => write!(f, "hearts"),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl FromStr for ObjectiveCriteria {
|
|
type Err = ();
|
|
|
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
match s {
|
|
"integer" => Ok(ObjectiveCriteria::Integer),
|
|
"hearts" => Ok(ObjectiveCriteria::Hearts),
|
|
_ => Err(()),
|
|
}
|
|
}
|
|
}
|