cmd_args/option/option_type.rs
1use std::fmt;
2
3/// Possible types for a CLI option.
4pub enum Type {
5 Bool { default: bool },
6 Str { default: String },
7 Int { default: i32 },
8 Float { default: f64 },
9}
10
11impl fmt::Display for Type {
12 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13 write!(f, "{}", match self {
14 Type::Bool { default: _ } => "boolean",
15 Type::Str { default: _ } => "string",
16 Type::Int { default: _ } => "integer",
17 Type::Float { default: _ } => "float",
18 })
19 }
20}