diff --git a/src/config.rs b/src/config.rs index 29bf33c..50daf67 100644 --- a/src/config.rs +++ b/src/config.rs @@ -17,14 +17,6 @@ pub struct Substitutor { pub action: Action, } -pub trait Match { - fn check_match(self, string: &str) -> bool; -} - -pub trait Act { - fn apply_action(self, input: String) -> String; -} - #[derive(Clone, Debug, Deserialize)] pub enum Matcher { #[serde(rename = "starts_with")] @@ -37,6 +29,24 @@ pub enum Matcher { Regex { pattern: String }, } +#[derive(Clone, Debug, Deserialize)] +pub enum Action { + #[serde(rename = "replace")] + Replace { from: String, to: String }, + #[serde(rename = "prefix")] + Prefix { prefix: String }, + #[serde(rename = "suffix")] + Suffix { suffix: String }, +} + +pub trait Match { + fn check_match(self, string: &str) -> bool; +} + +pub trait Act { + fn apply_action(self, input: String) -> String; +} + impl Match for Matcher { fn check_match(self, string: &str) -> bool { match self { @@ -51,16 +61,6 @@ impl Match for Matcher { } } -#[derive(Clone, Debug, Deserialize)] -pub enum Action { - #[serde(rename = "replace")] - Replace { from: String, to: String }, - #[serde(rename = "prefix")] - Prefix { prefix: String }, - #[serde(rename = "suffix")] - Suffix { suffix: String }, -} - impl Act for Action { fn apply_action(self, input: String) -> String { return match self {