use core::fmt;
#[derive(Debug, PartialEq)]
pub enum CommandArgument {
Named(String, CommandArgumentValue),
Positioned(usize, CommandArgumentValue),
}
#[derive(Clone, Debug, PartialEq)]
pub enum CommandArgumentValue {
String(String),
I64(i64),
F64(f64),
}
#[derive(Debug)]
pub enum CommandArgumentValueType {
String,
I64,
F64,
}
impl From<&'_ CommandArgumentValue> for CommandArgumentValueType {
fn from(value: &CommandArgumentValue) -> Self {
match value {
CommandArgumentValue::String(_) => CommandArgumentValueType::String,
CommandArgumentValue::I64(_) => CommandArgumentValueType::I64,
CommandArgumentValue::F64(_) => CommandArgumentValueType::F64,
}
}
}
impl fmt::Display for CommandArgumentValueType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
CommandArgumentValueType::String => write!(f, "String"),
CommandArgumentValueType::I64 => write!(f, "i64"),
CommandArgumentValueType::F64 => write!(f, "f64"),
}
}
}