From 3599fccf4eb646b4c4f9a2348d1a699074f75cc3 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 28 Nov 2021 15:16:43 +0530 Subject: [PATCH] config: sort --- src/config.rs | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) 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 {