Use is_valid for Id
This commit is contained in:
+5
-5
@@ -7,6 +7,7 @@ use crate::dictionary::{DictionaryMessage, DictionaryState, app_data_dir};
|
||||
use crate::dictionary_test::{DictionaryQuizMessage, DictionaryQuizState};
|
||||
use crate::history::{HistoryMessage, HistoryState};
|
||||
use crate::import::{ImportMessage, ImportState};
|
||||
use crate::lang::Id;
|
||||
use crate::message_navigation;
|
||||
use crate::navigation::Page::*;
|
||||
use crate::navigation::RootMessage::{DataLoaded, Keyboard, UpdateData};
|
||||
@@ -24,14 +25,13 @@ use crate::word::{WordMessage, WordState};
|
||||
use crate::writing::{WritingMessage, WritingState};
|
||||
use crate::{AppState, fill_state};
|
||||
use chrono::NaiveDate;
|
||||
use hashbrown::HashMap;
|
||||
use iced::keyboard::Event;
|
||||
use iced::{Element, Task};
|
||||
use reqwest::Error;
|
||||
use hashbrown::HashMap;
|
||||
use rusqlite::Connection;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Instant;
|
||||
use rusqlite::Connection;
|
||||
use crate::lang::Id;
|
||||
|
||||
impl Default for ScreenState {
|
||||
fn default() -> Self {
|
||||
@@ -127,7 +127,7 @@ impl ScreenState {
|
||||
for file in directory.read_dir().unwrap().flatten() {
|
||||
let mut vec = vec![];
|
||||
let history_file_name = file.file_name().into_string().unwrap();
|
||||
let id : Id = history_file_name[4..history_file_name.len() - 12]
|
||||
let id: Id = history_file_name[4..history_file_name.len() - 12]
|
||||
.parse::<Id>()
|
||||
.unwrap();
|
||||
|
||||
@@ -172,7 +172,7 @@ impl ScreenState {
|
||||
if let UpdateData = message {
|
||||
println!("Loading data");
|
||||
let mut state = self.app_state.lock().unwrap();
|
||||
if cfg!(windows){
|
||||
if cfg!(windows) {
|
||||
state.connection = Connection::open_in_memory().unwrap();
|
||||
}
|
||||
let path = app_data_dir();
|
||||
|
||||
Reference in New Issue
Block a user