refactor: move dictionary to util
This commit is contained in:
parent
0b9e486147
commit
1bc47b7c2d
5 changed files with 8 additions and 4 deletions
|
|
@ -7,7 +7,7 @@ use rustypipe::timeago::TimeUnit;
|
||||||
|
|
||||||
use crate::util;
|
use crate::util;
|
||||||
|
|
||||||
const TARGET_PATH: &str = "src/dictionary.rs";
|
const TARGET_PATH: &str = "src/util/dictionary.rs";
|
||||||
|
|
||||||
fn parse_tu(tu: &str) -> (u8, Option<TimeUnit>) {
|
fn parse_tu(tu: &str) -> (u8, Option<TimeUnit>) {
|
||||||
static TU_PATTERN: Lazy<Regex> = Lazy::new(|| Regex::new(r"^(\d*)(\w?)$").unwrap());
|
static TU_PATTERN: Lazy<Regex> = Lazy::new(|| Regex::new(r"^(\d*)(\w?)$").unwrap());
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
mod macros;
|
mod macros;
|
||||||
|
|
||||||
mod deobfuscate;
|
mod deobfuscate;
|
||||||
mod dictionary;
|
|
||||||
mod serializer;
|
mod serializer;
|
||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,10 @@ use std::ops::Mul;
|
||||||
use chrono::{DateTime, Duration, Local, NaiveDate, NaiveDateTime, NaiveTime, TimeZone};
|
use chrono::{DateTime, Duration, Local, NaiveDate, NaiveDateTime, NaiveTime, TimeZone};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{dictionary, model::Language, util};
|
use crate::{
|
||||||
|
model::Language,
|
||||||
|
util::{self, dictionary},
|
||||||
|
};
|
||||||
|
|
||||||
/// Parsed TimeAgo string, contains amount and time unit.
|
/// Parsed TimeAgo string, contains amount and time unit.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
pub mod dictionary;
|
||||||
|
|
||||||
use std::{borrow::Borrow, collections::BTreeMap, str::FromStr};
|
use std::{borrow::Borrow, collections::BTreeMap, str::FromStr};
|
||||||
|
|
||||||
use fancy_regex::Regex;
|
use fancy_regex::Regex;
|
||||||
|
|
@ -5,7 +7,7 @@ use once_cell::sync::Lazy;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use crate::{dictionary, error::Error, error::Result, model::Language};
|
use crate::{error::Error, error::Result, model::Language};
|
||||||
|
|
||||||
const CONTENT_PLAYBACK_NONCE_ALPHABET: &[u8; 64] =
|
const CONTENT_PLAYBACK_NONCE_ALPHABET: &[u8; 64] =
|
||||||
b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
||||||
|
|
|
||||||
Reference in a new issue