Switched from Vectors to HashMaps, need to update docs
This commit is contained in:
parent
6be0f7e8f6
commit
bae1d86544
@ -91,6 +91,7 @@ macro_rules! decode_settings {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use std::collections::HashMap;
|
||||||
/// Representation of the software’s settings
|
/// Representation of the software’s settings
|
||||||
///
|
///
|
||||||
/// This struct represents all the settings the software has to follow
|
/// This struct represents all the settings the software has to follow
|
||||||
@ -116,7 +117,7 @@ pub struct Settings {
|
|||||||
/// phonemes. It is currently not possible to have more than one
|
/// phonemes. It is currently not possible to have more than one
|
||||||
/// character to be considered as one sound.
|
/// character to be considered as one sound.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub categories: Vec<(String, String)>,
|
pub categories: HashMap<String, String>,
|
||||||
|
|
||||||
/// Soundchange rules
|
/// Soundchange rules
|
||||||
///
|
///
|
||||||
@ -124,7 +125,7 @@ pub struct Settings {
|
|||||||
/// a regex to be matched while the second represents the change
|
/// a regex to be matched while the second represents the change
|
||||||
/// to be made to the input data.
|
/// to be made to the input data.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub rules: Vec<(Regex, Regex)>,
|
pub rules: HashMap<Regex, Regex>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Representation inside the crate of LangEvolve’s settings.
|
/// Representation inside the crate of LangEvolve’s settings.
|
||||||
@ -148,8 +149,8 @@ impl Settings {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
version: Self::get_ruleset_version(),
|
version: Self::get_ruleset_version(),
|
||||||
categories: Vec::new(),
|
categories: HashMap::new(),
|
||||||
rules: Vec::new(),
|
rules: HashMap::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,13 @@ impl Regex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use std::hash::{Hash, Hasher};
|
||||||
|
impl Hash for Regex {
|
||||||
|
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||||
|
self.0.as_str().hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ops::Deref for Regex {
|
impl ops::Deref for Regex {
|
||||||
type Target = regex::Regex;
|
type Target = regex::Regex;
|
||||||
fn deref(&self) -> ®ex::Regex {
|
fn deref(&self) -> ®ex::Regex {
|
||||||
|
Loading…
Reference in New Issue
Block a user