code improvements and updates

This commit is contained in:
Simon Gardling
2022-05-11 14:44:25 -04:00
parent 66a05adefc
commit d9100c64cc
7 changed files with 35 additions and 30 deletions

View File

@@ -11,7 +11,7 @@ pub struct TextData {
pub welcome: String,
}
#[derive(Serialize, Deserialize)]
#[derive(Serialize, Deserialize, PartialEq, Debug)]
pub struct TotalData {
pub text: TextData,
pub fonts: epaint::text::FontDefinitions,

View File

@@ -17,7 +17,6 @@ use std::{io::Read, ops::BitXorAssign};
use rayon::iter::{IndexedParallelIterator, ParallelIterator};
/// Stores current settings/state of [`MathApp`]
// TODO: find a better name for this
#[derive(Copy, Clone)]
pub struct AppSettings {
/// Stores the type of Rienmann sum that should be calculated
@@ -46,8 +45,7 @@ pub struct AppSettings {
}
impl const Default for AppSettings {
/// Default implementation of `AppSettings`, this is how the application
/// starts up
/// Default implementation of `AppSettings`, this is how the application starts up
fn default() -> Self {
Self {
riemann_sum: DEFAULT_RIEMANN,
@@ -144,10 +142,12 @@ impl MathApp {
let mut data = Vec::new();
let _ = unsafe {
ruzstd::StreamingDecoder::new(&mut include_bytes!("../assets/data").as_slice())
.unwrap_unchecked()
.read_to_end(&mut data)
.unwrap_unchecked()
ruzstd::StreamingDecoder::new(
&mut include_bytes!(concat!(env!("OUT_DIR"), "/compressed_data")).as_slice(),
)
.unwrap_unchecked()
.read_to_end(&mut data)
.unwrap_unchecked()
};
let data: crate::data::TotalData = bincode::deserialize(data.as_slice()).unwrap();