Skip to main content

hone/
param.rs

1use serde::{Deserialize, Serialize};
2use std::fmt;
3use structopt::StructOpt;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct Param {
7    pub name: String,
8    pub spec: ParamSpec,
9}
10
11#[derive(Debug, Clone, Serialize, Deserialize, StructOpt)]
12#[structopt(rename_all = "kebab-case")]
13#[serde(tag = "type", rename_all = "SCREAMING_SNAKE_CASE")]
14pub enum ParamSpec {
15    Choice { choices: Vec<String> },
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct ParamValue(pub String);
20
21impl fmt::Display for ParamValue {
22    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
23        write!(f, "{}", self.0)
24    }
25}