summaryrefslogtreecommitdiff
path: root/src/parameter.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-09-28 14:29:53 +0200
committertroido <troido@protonmail.com>2020-09-28 14:29:53 +0200
commiteb9853dec24045adb7447e1c8ac186e52204b690 (patch)
tree7fb944311d64ca5a8ff41748fbd5209a2eaf9806 /src/parameter.rs
parent25abc71200803f7238c56c93b8b89160ff6c1086 (diff)
removed parametertype
Diffstat (limited to 'src/parameter.rs')
-rw-r--r--src/parameter.rs47
1 files changed, 9 insertions, 38 deletions
diff --git a/src/parameter.rs b/src/parameter.rs
index be846a1..36bb100 100644
--- a/src/parameter.rs
+++ b/src/parameter.rs
@@ -1,50 +1,21 @@
use serde::{Serialize, Deserialize};
-use strum_macros::{EnumString, Display};
use crate::{
Template,
};
-
-macro_rules! parameters {
- {$($name: ident $typ: ty);*;} => {
- #[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
- #[serde(untagged)]
- pub enum Parameter {
- $(
- $name($typ),
- )*
- }
- impl Parameter {
- pub fn paramtype(&self) -> ParameterType {
- match self {
- $(
- Self::$name(_) => ParameterType::$name,
- )*
- }
- }
- }
-
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, EnumString, Display)]
- #[serde(rename_all = "lowercase")]
- #[strum(serialize_all = "lowercase")]
- pub enum ParameterType {
- $(
- $name,
- )*
- }
- }
+#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum Parameter {
+ String(String),
+ Int(i64),
+ Float(f64),
+ Template(Template),
+ Bool(bool),
+ List(Vec<Parameter>)
}
-parameters!{
- String String;
- Int i64;
- Float f64;
- Template Template;
- Bool bool;
- List Vec<Parameter>;
-}
impl Parameter {