working on refactoring some functions

This commit is contained in:
2023-05-08 16:41:30 +02:00
parent 758108c925
commit 62a81cfaab
3 changed files with 15 additions and 16 deletions

View File

@@ -21,16 +21,6 @@ impl Field {
}
}
// I shouldn't need this; remove when done with testing FIXME
impl Default for Field {
fn default() -> Self {
Self {
field: Default::default(),
num_chars: Default::default()
}
}
}
#[derive(Serialize, Deserialize)]
pub struct Rating {
pub nil: char,
@@ -93,6 +83,14 @@ impl Config {
pub fn priorities_to_lower(&mut self) {
self.player_priorities = self.player_priorities.iter().map(|i| i.to_lowercase()).collect();
}
pub fn find_player_priorities_idx(&self, name: &str) -> i32 {
match self.player_priorities.iter()
.position(|x| x.to_ascii_lowercase().eq(&name.to_ascii_lowercase())) {
Some(idx) => idx as i32,
None => i32::MAX,
}
}
}
fn ms(str: &str) -> String {