update dependencies

This commit is contained in:
Simon Gardling 2023-04-18 10:14:31 -04:00
parent cb6a773659
commit 7e1fe54d59
18 changed files with 484 additions and 572 deletions

979
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,16 @@ fn font_stripper(from: &str, out: &str, unicodes: Vec<char>) -> Result<Vec<u8>,
.collect::<Vec<String>>()
.join(",");
let pyftsubset_detect = run_script::run("whereis pyftsubset", &(vec![]), &ScriptOptions::new());
match pyftsubset_detect {
Ok((_i, s1, _s2)) => {
if s1 == "pyftsubset: " {
return Err(String::from("pyftsubset not found"));
}
}
Err(x) => return Err(x.to_string()),
}
let script_result = run_script::run(
&format!(
"pyftsubset {}/assets/{} --unicodes={}

0
build.sh Executable file → Normal file
View File

View File

@ -10,13 +10,13 @@ description = "Parsing library for YTBN-Graphing-Software"
[lib]
[dependencies]
phf = { version = "0.11", no-default-features = true }
phf = { version = "0.11" }
exmex = { git = "https://github.com/bertiqwerty/exmex.git", branch = "main", features = [
"partial",
] }
[build-dependencies]
phf_codegen = { version = "0.11", no-default-features = true }
phf_codegen = { version = "0.11" }
[package.metadata.cargo-all-features]
skip_optional_dependencies = true #don't test optional dependencies, only features

View File

@ -34,7 +34,7 @@ impl<'a> const Default for AutoComplete<'a> {
}
impl<'a> AutoComplete<'a> {
const EMPTY: AutoComplete<'a> = Self {
pub const EMPTY: AutoComplete<'a> = Self {
i: 0,
hint: &HINT_EMPTY,
string: String::new(),

View File

@ -1,6 +1,5 @@
#![feature(const_trait_impl)]
#![feature(core_intrinsics)]
#![feature(const_default_impls)]
#![feature(const_mut_refs)]
#![feature(const_for)]
mod autocomplete;

0
push.sh Executable file → Normal file
View File

View File

@ -11,7 +11,7 @@ pub const BUILD_INFO: &str = formatc!(
&build::BUILD_TIME,
&build::PKG_VERSION,
&build::RUST_CHANNEL,
&build::RUST_VERSION[6..],
&build::RUST_VERSION,
);
pub const FONT_SIZE: f32 = 14.0;

View File

@ -1,5 +1,5 @@
use crate::math_app::AppSettings;
use crate::misc::*;
use crate::misc::{newtons_method_helper, step_helper, EguiHelper};
use egui::{
plot::{BarChart, PlotPoint, PlotUi},
widgets::plot::Bar,
@ -139,7 +139,7 @@ impl FunctionEntry {
extrema_data: Vec::new(),
root_data: Vec::new(),
nth_derivative_data: None,
autocomplete: AutoComplete::default(),
autocomplete: AutoComplete::EMPTY,
test_result: None,
curr_nth: 3,
settings_opened: false,

View File

@ -2,8 +2,6 @@
#![feature(let_chains)]
#![feature(const_trait_impl)]
#![feature(core_intrinsics)]
#![feature(const_convert)]
#![feature(const_default_impls)]
#![feature(const_fn_floating_point_arithmetic)]
#![feature(const_assume)]
#![feature(const_option_ext)]
@ -27,14 +25,14 @@ pub use crate::{
function_entry::{FunctionEntry, Riemann},
math_app::AppSettings,
misc::{
// decimal_round,
hashed_storage_create,
hashed_storage_read,
newtons_method,
option_vec_printer,
step_helper,
EguiHelper,
// decimal_round,
// hashed_storage_create,
HashBytesHelper,
HashBytes,
},
unicode_helper::{to_chars_array, to_unicode_hash},
};

View File

@ -2,8 +2,6 @@
#![feature(let_chains)]
#![feature(const_trait_impl)]
#![feature(core_intrinsics)]
#![feature(const_convert)]
#![feature(const_default_impls)]
#![feature(const_fn_floating_point_arithmetic)]
#![feature(const_assume)]
#![feature(const_option_ext)]

View File

@ -1,5 +1,8 @@
use crate::{
consts::*, function_entry::Riemann, function_manager::FunctionManager, misc::option_vec_printer,
consts::{build, BUILD_INFO, COLORS, DEFAULT_INTEGRAL_NUM, DEFAULT_MAX_X, DEFAULT_MIN_X},
function_entry::Riemann,
function_manager::FunctionManager,
misc::option_vec_printer,
};
use eframe::App;
use egui::{
@ -9,6 +12,7 @@ use egui::{
use emath::{Align, Align2};
use epaint::Rounding;
use instant::Instant;
use itertools::Itertools;
use std::{io::Read, ops::BitXorAssign};
/// Stores current settings/state of [`MathApp`]
@ -257,7 +261,7 @@ impl MathApp {
functions: FunctionManager::default(),
last_info: (None, None),
opened: const { Opened::default() },
opened: Opened::default(),
settings: AppSettings::default(),
}
}
@ -552,7 +556,7 @@ impl App for MathApp {
CentralPanel::default()
.frame(Frame {
inner_margin: Margin::symmetric(0.0, 0.0),
rounding: Rounding::none(),
rounding: Rounding::ZERO,
// fill: crate::style::STYLE.window_fill(),
fill: Color32::from_gray(27),
..Frame::none()
@ -572,7 +576,7 @@ impl App for MathApp {
format!("(Function #{}) {}\n", i, error.as_ref().unwrap_unchecked())
}
})
.collect::<String>();
.join("");
if !errors_formatted.is_empty() {
ui.centered_and_justified(|ui| {

View File

@ -22,9 +22,7 @@ pub trait EguiHelper {
impl EguiHelper for Vec<PlotPoint> {
#[inline(always)]
fn to_values(self) -> PlotPoints {
let a: Vec<[f64; 2]> =
unsafe { std::mem::transmute::<Vec<PlotPoint>, Vec<[f64; 2]>>(self) };
PlotPoints::from(a)
PlotPoints::from(unsafe { std::mem::transmute::<Vec<PlotPoint>, Vec<[f64; 2]>>(self) })
}
#[inline(always)]
@ -44,7 +42,7 @@ pub trait Offset {
fn offset_x(self, x_offset: f32) -> Pos2;
}
impl Offset for Pos2 {
impl const Offset for Pos2 {
fn offset_y(self, y_offset: f32) -> Pos2 {
Pos2 {
x: self.x,
@ -165,18 +163,13 @@ pub const HASH_LENGTH: usize = 8;
/// Represents bytes used to represent hash info
pub type HashBytes = [u8; HASH_LENGTH];
pub trait HashBytesHelper {
fn hashed_storage_create(&self, data: &[u8]) -> String;
}
impl HashBytesHelper for HashBytes {
fn hashed_storage_create(&self, data: &[u8]) -> String {
unsafe { std::mem::transmute::<Vec<u8>, String>([self, data].concat()) }
}
#[allow(dead_code)]
pub fn hashed_storage_create(hashbytes: &HashBytes, data: &[u8]) -> String {
unsafe { std::mem::transmute::<Vec<u8>, String>([hashbytes, data].concat()) }
}
#[allow(dead_code)]
pub const fn hashed_storage_read(data: &str) -> Option<(HashBytes, &[u8])> {
pub fn hashed_storage_read(data: &str) -> Option<(HashBytes, &[u8])> {
// Make sure data is long enough to decode
if HASH_LENGTH >= data.len() {
return None;

View File

@ -4,7 +4,7 @@ use itertools::Itertools;
pub fn to_unicode_hash(c: char) -> String {
c.escape_unicode()
.to_string()
.replace(r#"\\u{"#, "")
.replace(r"\\u{", "")
.replace(['{', '}'], "")
.to_uppercase()
}

View File

@ -1,9 +1,8 @@
use crate::misc::Offset;
use egui::{Id, InnerResponse};
/// Creates an area ontop of a widget with an y offset
pub fn widgets_ontop<R>(
ui: &mut egui::Ui, id: Id, re: &egui::Response, y_offset: f32,
ui: &egui::Ui, id: Id, re: &egui::Response, y_offset: f32,
add_contents: impl FnOnce(&mut egui::Ui) -> R,
) -> InnerResponse<R> {
let area = egui::Area::new(id)

0
start-server.sh Executable file → Normal file
View File

View File

@ -62,7 +62,7 @@ fn option_vec_printer() {
#[test]
fn hashed_storage() {
use ytbn_graphing_software::{hashed_storage_read, HashBytesHelper};
use ytbn_graphing_software::{hashed_storage_create, hashed_storage_read};
let commit = "abcdefeg".chars().map(|c| c as u8).collect::<Vec<u8>>();
let data = "really cool data"
@ -73,7 +73,7 @@ fn hashed_storage() {
.as_slice()
.try_into()
.expect("cannot turn into [u8; 8]");
let storage = storage_tmp.hashed_storage_create(data.as_slice());
let storage = hashed_storage_create(&storage_tmp, data.as_slice());
let read = hashed_storage_read(&storage);
assert_eq!(
@ -208,6 +208,6 @@ fn to_chars_array() {
use ytbn_graphing_software::to_chars_array;
assert_eq!(
to_chars_array(vec!['\u{1f31e}', '\u{2d12c}']),
r#"['\u{1f31e}', '\u{2d12c}']"#
r"['\u{1f31e}', '\u{2d12c}']"
);
}

View File

@ -3,7 +3,7 @@ use std::collections::HashMap;
#[test]
fn hashmap_gen_test() {
let data = vec!["time", "text", "test"];
let data = ["time", "text", "test"];
let expect = vec![
("t", "Hint::Many(&[\"ime(\", \"ext(\", \"est(\"])"),
("te", "Hint::Many(&[\"xt(\", \"st(\"])"),