cleanup
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
consts::{BUILD_INFO, COLORS, DEFAULT_INTEGRAL_NUM, DEFAULT_MAX_X, DEFAULT_MIN_X, build},
|
||||
consts::{COLORS, DEFAULT_INTEGRAL_NUM, DEFAULT_MAX_X, DEFAULT_MIN_X},
|
||||
function_entry::Riemann,
|
||||
function_manager::FunctionManager,
|
||||
misc::option_vec_printer,
|
||||
@@ -138,8 +138,6 @@ impl MathApp {
|
||||
#[cfg(not(threading))]
|
||||
tracing::info!("Threading: Disabled");
|
||||
|
||||
tracing::info!("commit: {}", build::SHORT_COMMIT);
|
||||
|
||||
tracing::info!("Initializing...");
|
||||
let start = Instant::now();
|
||||
|
||||
@@ -150,26 +148,24 @@ impl MathApp {
|
||||
|
||||
fn get_storage_decompressed() -> Option<Vec<u8>> {
|
||||
let data = get_localstorage().get_item(DATA_NAME).ok()??;
|
||||
let (commit, cached_data) = crate::misc::hashed_storage_read(&data)?;
|
||||
let cached_data = crate::misc::hashed_storage_read(&data)?;
|
||||
|
||||
tracing::info!("Reading decompression cache. Bytes: {}", cached_data.len());
|
||||
return Some(cached_data);
|
||||
|
||||
if commit == unsafe { std::mem::transmute::<&str, crate::misc::HashBytes>(build::SHORT_COMMIT) } {
|
||||
tracing::info!("Reading decompression cache. Bytes: {}", cached_data.len());
|
||||
return Some(cached_data);
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn load_functions() -> Option<FunctionManager> {
|
||||
let data = get_localstorage().get_item(FUNC_NAME).ok()??;
|
||||
let (commit, func_data) = crate::misc::hashed_storage_read(&data)?;
|
||||
let func_data = crate::misc::hashed_storage_read(&data)?;
|
||||
|
||||
if commit == unsafe { std::mem::transmute::<&str, &[u8]>(build::SHORT_COMMIT) } {
|
||||
tracing::info!("Reading previous function data");
|
||||
let function_manager: FunctionManager = bincode::deserialize(&func_data).ok()?;
|
||||
|
||||
tracing::info!("Reading previous function data");
|
||||
if let Ok(Some(function_manager)) = bincode::deserialize(&func_data) {
|
||||
return Some(function_manager);
|
||||
} else {
|
||||
None
|
||||
tracing::info!("Unable to load functionManager instance");
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,12 +187,8 @@ impl MathApp {
|
||||
#[cfg(target = "wasm32")]
|
||||
{
|
||||
tracing::info!("Setting decompression cache");
|
||||
let commit: crate::misc::HashBytes = const {
|
||||
unsafe {
|
||||
std::mem::transmute::<&str, crate::misc::HashBytes>(build::SHORT_COMMIT)
|
||||
}
|
||||
};
|
||||
let saved_data = commit.hashed_storage_create(data);
|
||||
|
||||
let saved_data = hashed_storage_create(data);
|
||||
tracing::info!("Bytes: {}", saved_data.len());
|
||||
get_localstorage()
|
||||
.set_item(DATA_NAME, saved_data)
|
||||
@@ -362,11 +354,9 @@ impl MathApp {
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
{
|
||||
tracing::info!("Saving function data");
|
||||
use crate::misc::{HashBytes, hashed_storage_create};
|
||||
let hash: HashBytes =
|
||||
unsafe { std::mem::transmute::<&str, HashBytes>(build::SHORT_COMMIT) };
|
||||
use crate::misc::hashed_storage_create;
|
||||
|
||||
let saved_data = hashed_storage_create(
|
||||
hash,
|
||||
&bincode::serialize(&self.functions)
|
||||
.expect("unable to deserialize functions"),
|
||||
);
|
||||
@@ -520,8 +510,6 @@ impl App for MathApp {
|
||||
.resizable(false)
|
||||
.collapsible(false)
|
||||
.show(ctx, |ui| {
|
||||
ui.add(egui::Label::new(BUILD_INFO));
|
||||
|
||||
if let Some(ref took) = self.last_info.1 {
|
||||
ui.label(took);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user