Migrate to hashbrown structures

This commit is contained in:
2026-08-16 23:50:14 +03:00
parent dcf7352553
commit 3fcbd235cf
5 changed files with 7 additions and 15 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
use rusqlite::Connection;
use serde_json::Value;
use std::collections::HashMap;
use hashbrown::HashMap;
#[derive(Clone)]
pub struct ImportData(pub(crate) Vec<ImportGroup>);
+1 -1
View File
@@ -18,7 +18,7 @@ use iced::widget::*;
use iced::{Border, Color, Shadow, Task};
use iced_core::Length::Fill;
use rand::random_range;
use std::collections::{HashMap, HashSet};
use hashbrown::{HashMap, HashSet};
use std::fs;
use std::ops::Add;
use std::path::PathBuf;
+1 -1
View File
@@ -34,7 +34,7 @@ use iced_core::window::Position;
use iced_core::window::settings::PlatformSpecific;
use mimalloc::MiMalloc;
use rusqlite::Connection;
use std::collections::HashMap;
use hashbrown::HashMap;
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
+3 -1
View File
@@ -27,7 +27,7 @@ use chrono::NaiveDate;
use iced::keyboard::Event;
use iced::{Element, Task};
use reqwest::Error;
use std::collections::HashMap;
use hashbrown::HashMap;
use std::sync::{Arc, Mutex};
use std::time::Instant;
use rusqlite::Connection;
@@ -171,7 +171,9 @@ impl ScreenState {
if let UpdateData = message {
println!("Loading data");
let mut state = self.app_state.lock().unwrap();
if cfg!(windows){
state.connection = Connection::open_in_memory().unwrap();
}
let path = app_data_dir();
let db_file = path.join("data.db");
let temp_db_file = path.join("data.db.tmp");
-10
View File
@@ -97,9 +97,7 @@ impl NavigatedPage<RepetitionsMessage> for RepetitionsState {
.iter()
.map(|c| self.word_id_index_map[&c.word_id])
.collect();
println!("Already exists {:?}", added);
let total = set.get_word_list(&state);
println!("Available{:?}", total);
self.current_sets_cards_cache.insert(index, (added, total));
@@ -164,14 +162,6 @@ impl NavigatedPage<RepetitionsMessage> for RepetitionsState {
.cloned()
.collect();
for x in &cache.0 {
println!("Already exists {:?}", state.dictionary.get(*x).unwrap());
}
for w in &adding {
println!("{:?}", state.dictionary.get(*w).unwrap());
}
let mut new_current = cache.0.clone();
new_current.append(&mut adding.clone());
total_cache.insert(index, (new_current, cache.1.clone()));