-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
429 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||
pub struct Rule { | ||
pub id: String, | ||
pub is_regex: bool, | ||
pub rule: String, | ||
pub to: String, | ||
} | ||
|
||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||
pub struct Dictionary { | ||
pub rules: Vec<Rule>, | ||
} | ||
|
||
impl Dictionary { | ||
pub fn new() -> Self { | ||
let rules = vec![ | ||
Rule { | ||
id: String::from("url"), | ||
is_regex: true, | ||
rule: String::from(r"(http://|https://){1}[\w\.\-/:\#\?=\&;%\~\+]+"), | ||
to: String::from("URL"), | ||
}, | ||
Rule { | ||
id: String::from("code"), | ||
is_regex: true, | ||
rule: String::from(r"```(.|\n)*```"), | ||
to: String::from("code"), | ||
}, | ||
]; | ||
Self { rules } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
pub mod database; | ||
pub mod dictionary; | ||
pub mod server_config; | ||
pub mod user_config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use super::dictionary::Dictionary; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||
pub struct ServerConfig { | ||
pub dictionary: Dictionary, | ||
} |
Oops, something went wrong.