cleanup hashed_storage_create
This commit is contained in:
@@ -223,7 +223,7 @@ impl MathApp {
|
|||||||
std::mem::transmute::<&str, crate::misc::HashBytes>(build::SHORT_COMMIT)
|
std::mem::transmute::<&str, crate::misc::HashBytes>(build::SHORT_COMMIT)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let saved_data = &crate::misc::hashed_storage_create(commit, data);
|
let saved_data = &crate::misc::hashed_storage_create(&commit, data);
|
||||||
tracing::info!("Bytes: {}", saved_data.len());
|
tracing::info!("Bytes: {}", saved_data.len());
|
||||||
get_localstorage()
|
get_localstorage()
|
||||||
.set_item(DATA_NAME, saved_data)
|
.set_item(DATA_NAME, saved_data)
|
||||||
@@ -394,7 +394,7 @@ impl MathApp {
|
|||||||
std::mem::transmute::<&str, crate::misc::HashBytes>(build::SHORT_COMMIT)
|
std::mem::transmute::<&str, crate::misc::HashBytes>(build::SHORT_COMMIT)
|
||||||
};
|
};
|
||||||
let saved_data = &crate::misc::hashed_storage_create(
|
let saved_data = &crate::misc::hashed_storage_create(
|
||||||
hash,
|
&hash,
|
||||||
bincode::serialize(&self.functions).unwrap().as_slice(),
|
bincode::serialize(&self.functions).unwrap().as_slice(),
|
||||||
);
|
);
|
||||||
// tracing::info!("Bytes: {}", saved_data.len());
|
// tracing::info!("Bytes: {}", saved_data.len());
|
||||||
|
|||||||
@@ -143,8 +143,8 @@ pub const HASH_LENGTH: usize = 8;
|
|||||||
pub type HashBytes = [u8; HASH_LENGTH];
|
pub type HashBytes = [u8; HASH_LENGTH];
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn hashed_storage_create(hash: HashBytes, data: &[u8]) -> String {
|
pub fn hashed_storage_create<'a>(hash: &HashBytes, data: &[u8]) -> String {
|
||||||
unsafe { std::mem::transmute::<Vec<u8>, String>([&hash, data].concat()) }
|
unsafe { std::mem::transmute::<Vec<u8>, String>([hash, data].concat()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|||||||
Reference in New Issue
Block a user