update EVERYTHING and rebase egui and depdencies

This commit is contained in:
Simon Gardling 2025-12-02 22:40:08 -05:00
parent 33847acd53
commit dd377c1659
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
16 changed files with 1904 additions and 1489 deletions

3027
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,8 @@
[package]
name = "ytbn_graphing_software"
version = "0.1.0"
edition = "2021"
edition = "2024"
rust-version = "1.88"
license = "AGPL-3.0"
repository = "https://github.com/Titaniumtown/YTBN-Graphing-Software"
description = "Crossplatform (and web-compatible) graphing calculator"
@ -33,62 +34,72 @@ strip = false
[dependencies]
parsing = { path = "./parsing" }
eframe = { git = "https://github.com/titaniumtown/egui.git", default-features = false, features = [
eframe = { path = "../simon-egui/crates/eframe", default-features = false, features = [
"glow",
"x11",
] }
egui = { git = "https://github.com/titaniumtown/egui.git", default-features = false, features = [
egui = { path = "../simon-egui/crates/egui", default-features = false, features = [
"serde",
] }
epaint = { git = "https://github.com/titaniumtown/egui.git", default-features = false , features = [
epaint = { path = "../simon-egui/crates/epaint", default-features = false, features = [
"bytemuck",
] }
emath = { git = "https://github.com/titaniumtown/egui.git", default-features = false }
egui_plot = { git = "https://github.com/titaniumtown/egui.git", default-features = false }
emath = { path = "../simon-egui/crates/emath", default-features = false }
egui_plot = { git = "https://github.com/emilk/egui_plot.git", default-features = false }
shadow-rs = { version = "0.12", default-features = false }
shadow-rs = { version = "0.38", default-features = false }
const_format = { version = "0.2", default-features = false, features = ["fmt"] }
cfg-if = "1"
ruzstd = "0.5"
ruzstd = "0.8"
tracing = "0.1"
itertools = "0.10"
itertools = "0.14"
static_assertions = "1.1"
bincode = "1.3"
serde = "1"
log = "0.4"
[dev-dependencies]
benchmarks = { path = "./benchmarks" }
# Note: benchmarks are in a separate crate - run with:
# cd benchmarks && cargo bench
[build-dependencies]
shadow-rs = "0.12"
epaint = { git = "https://github.com/titaniumtown/egui.git", default-features = false, features = [
shadow-rs = "0.38"
epaint = { path = "../simon-egui/crates/epaint", default-features = false, features = [
"bytemuck",
] }
egui = { git = "https://github.com/titaniumtown/egui.git", default-features = false, features = [
egui = { path = "../simon-egui/crates/egui", default-features = false, features = [
"serde",
] }
bincode = "1.3"
serde = "1"
serde_json = "1"
zstd = { version = "0.11", default-features = false, features = ["pkg-config"] }
run_script = "0.9"
zstd = { version = "0.13", default-features = false }
run_script = "0.10"
json5 = "0.4"
itertools = "0.10"
itertools = "0.14"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
instant = "0.1"
web-time = "1.1"
tracing-subscriber = "0.3"
getrandom = { version = "0.2" }
getrandom = { version = "0.3" }
[target.'cfg(target_arch = "wasm32")'.dependencies]
instant = { version = "0.1", features = ["wasm-bindgen"] }
lol_alloc = "0.4.0"
web-time = "1.1"
lol_alloc = "0.4"
wasm-bindgen = { version = "0.2", default-features = false, features = ["std"] }
web-sys = "0.3"
tracing-wasm = "0.2"
getrandom = { version = "0.2", features = ["js"] }
wasm-bindgen-futures = "0.4.34"
getrandom = { version = "0.3", features = ["wasm_js"] }
wasm-bindgen-futures = "0.4"
[package.metadata.cargo-all-features]
skip_optional_dependencies = true #don't test optional dependencies, only features
[patch.crates-io]
egui = { path = "../simon-egui/crates/egui" }
epaint = { path = "../simon-egui/crates/epaint" }
emath = { path = "../simon-egui/crates/emath" }
ecolor = { path = "../simon-egui/crates/ecolor" }
eframe = { path = "../simon-egui/crates/eframe" }
egui-winit = { path = "../simon-egui/crates/egui-winit" }
egui_glow = { path = "../simon-egui/crates/egui_glow" }
egui-wgpu = { path = "../simon-egui/crates/egui-wgpu" }

View File

@ -1,13 +1,18 @@
[package]
name = "benchmarks"
version = "0.1.0"
edition = "2021"
edition = "2024"
rust-version = "1.88"
license = "AGPL-3.0"
[lib]
bench = false
[[bench]]
name = "split_function"
harness = false
[dependencies]
pprof = { version = "0.9", features = ["flamegraph"] }
criterion = "0.3"
criterion-macro = "0.3"
pprof = { version = "0.14", features = ["flamegraph"] }
criterion = { version = "0.5", features = ["html_reports"] }
parsing = { path = "../parsing" }

View File

@ -0,0 +1,46 @@
use criterion::{criterion_group, criterion_main, Criterion};
use parsing::split_function_chars;
use std::time::Duration;
fn custom_criterion() -> Criterion {
Criterion::default()
.warm_up_time(Duration::from_millis(250))
.sample_size(1000)
}
fn mutli_split_function(c: &mut Criterion) {
let data_chars = vec![
"sin(x)cos(x)",
"x^2",
"2x",
"log10(x)",
"E^x",
"xxxxx",
"xsin(x)",
"(2x+1)(3x+1)",
"x**2",
"pipipipipipix",
"pi(2x+1)",
"(2x+1)pi",
]
.iter()
.map(|a| a.chars().collect::<Vec<char>>())
.collect::<Vec<Vec<char>>>();
let mut group = c.benchmark_group("split_function");
for entry in data_chars {
group.bench_function(entry.iter().collect::<String>(), |b| {
b.iter(|| {
split_function_chars(&entry, parsing::SplitType::Multiplication);
})
});
}
group.finish();
}
criterion_group! {
name = benches;
config = custom_criterion();
targets = mutli_split_function
}
criterion_main!(benches);

View File

@ -1,26 +1,18 @@
#![feature(custom_test_frameworks)]
#![test_runner(criterion::runner)]
//! Benchmarks library - profiler utilities for flamegraphs
#[allow(unused_imports)]
use parsing::split_function_chars;
#[allow(unused_imports)]
use std::time::Duration;
use std::{fs::File, os::raw::c_int, path::Path};
use criterion::profiler::Profiler;
#[allow(unused_imports)]
use criterion::{BenchmarkId, Criterion};
use criterion_macro::criterion;
use pprof::ProfilerGuard;
/// Flamegraph profiler for criterion benchmarks
pub struct FlamegraphProfiler<'a> {
frequency: c_int,
active_profiler: Option<ProfilerGuard<'a>>,
}
impl<'a> FlamegraphProfiler<'a> {
#[allow(dead_code)]
/// Create a new flamegraph profiler with the given sampling frequency
pub fn new(frequency: c_int) -> Self {
FlamegraphProfiler {
frequency,
@ -29,7 +21,7 @@ impl<'a> FlamegraphProfiler<'a> {
}
}
impl<'a> Profiler for FlamegraphProfiler<'a> {
impl Profiler for FlamegraphProfiler<'_> {
fn start_profiling(&mut self, _benchmark_id: &str, _benchmark_dir: &Path) {
self.active_profiler = Some(ProfilerGuard::new(self.frequency).unwrap());
}
@ -49,57 +41,3 @@ impl<'a> Profiler for FlamegraphProfiler<'a> {
}
}
}
#[allow(dead_code)] // this infact IS used by benchmarks
fn custom_criterion() -> Criterion {
Criterion::default()
.warm_up_time(Duration::from_millis(250))
.sample_size(1000)
}
#[allow(dead_code)] // this infact IS used by benchmarks
fn custom_criterion_flamegraph() -> Criterion {
custom_criterion().with_profiler(FlamegraphProfiler::new(100))
}
#[criterion(custom_criterion())]
fn mutli_split_function(c: &mut Criterion) {
let data_chars = vec![
"sin(x)cos(x)",
"x^2",
"2x",
"log10(x)",
"E^x",
"xxxxx",
"xsin(x)",
"(2x+1)(3x+1)",
"x**2",
"pipipipipipix",
"pi(2x+1)",
"(2x+1)pi",
]
.iter()
.map(|a| a.chars().collect::<Vec<char>>())
.collect::<Vec<Vec<char>>>();
let mut group = c.benchmark_group("split_function");
for entry in data_chars {
group.bench_function(entry.iter().collect::<String>(), |b| {
b.iter(|| {
split_function_chars(&entry, parsing::suggestions::SplitType::Multiplication);
})
});
}
group.finish();
}
// #[criterion(custom_criterion_flamegraph())]
// fn single_split_function(c: &mut Criterion) {
// let data_chars = "(2x+1)(3x+1)".chars().collect::<Vec<char>>();
// c.bench_function("split_function", |b| {
// b.iter(|| {
// split_function_chars(&data_chars);
// });
// });
// }

View File

@ -4,6 +4,7 @@ use std::{
fs::File,
io::{BufWriter, Write},
path::Path,
sync::Arc,
};
use epaint::{
@ -72,7 +73,7 @@ fn main() {
println!("cargo:rerun-if-changed=.git/logs/HEAD");
println!("cargo:rerun-if-changed=assets/*");
shadow_rs::new().expect("Could not initialize shadow_rs");
shadow_rs::ShadowBuilder::builder().build().expect("Could not initialize shadow_rs");
let mut main_chars: Vec<char> =
b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzsu0123456789?.,!(){}[]-_=+-/<>'\\ :^*`@#$%&|~;"
@ -104,37 +105,36 @@ fn main() {
font_data: BTreeMap::from([
(
"Ubuntu-Light".to_owned(),
FontData::from_owned(
Arc::new(FontData::from_owned(
font_stripper(
"Ubuntu-Light.ttf",
"ubuntu-light.ttf",
[main_chars, vec!['∫']].concat(),
)
.unwrap(),
),
)),
),
(
"NotoEmoji-Regular".to_owned(),
FontData::from_owned(
Arc::new(FontData::from_owned(
font_stripper(
"NotoEmoji-Regular.ttf",
"noto-emoji.ttf",
vec!['🌞', '🌙', '✖'],
)
.unwrap(),
),
)),
),
(
"emoji-icon-font".to_owned(),
FontData::from_owned(
Arc::new(FontData::from_owned(
font_stripper("emoji-icon-font.ttf", "emoji-icon.ttf", vec!['⚙']).unwrap(),
)
.tweak(FontTweak {
scale: 0.8,
y_offset_factor: 0.07,
y_offset: 0.0,
baseline_offset_factor: -0.0333,
}),
})),
),
]),
families: BTreeMap::from([

View File

@ -18,7 +18,7 @@ impl Movement {
pub const fn is_complete(&self) -> bool { matches!(&self, &Self::Complete) }
}
impl const Default for Movement {
impl Default for Movement {
fn default() -> Self { Self::None }
}
@ -29,7 +29,7 @@ pub struct AutoComplete<'a> {
pub string: String,
}
impl<'a> const Default for AutoComplete<'a> {
impl<'a> Default for AutoComplete<'a> {
fn default() -> AutoComplete<'a> { AutoComplete::EMPTY }
}

View File

@ -1,6 +1,3 @@
#![feature(const_trait_impl)]
#![feature(const_mut_refs)]
#![feature(const_for)]
mod autocomplete;
mod autocomplete_hashmap;
mod parsing;

View File

@ -58,7 +58,7 @@ impl FlatExWrapper {
.as_ref()
.map(|f| {
f.clone()
.partial_iter((0..=n).map(|_| 0))
.partial_iter((0..n).map(|_| 0))
.map(Self::new)
.unwrap_or(Self::EMPTY)
})
@ -66,7 +66,7 @@ impl FlatExWrapper {
}
}
impl const Default for FlatExWrapper {
impl Default for FlatExWrapper {
fn default() -> FlatExWrapper { FlatExWrapper::EMPTY }
}
/// Function that includes f(x), f'(x), f'(x)'s string representation, and f''(x)

View File

@ -118,7 +118,7 @@ impl<'de> Deserialize<'de> for FunctionEntry {
}
}
impl const Default for FunctionEntry {
impl Default for FunctionEntry {
/// Creates default FunctionEntry instance (which is empty)
fn default() -> FunctionEntry {
FunctionEntry {
@ -379,7 +379,7 @@ impl FunctionEntry {
.cloned()
.collect::<Vec<PlotPoint>>()
.to_line()
.stroke(epaint::Stroke::NONE)
.stroke((0.0, Color32::TRANSPARENT))
.color(Color32::from_rgb(4, 4, 255))
.fill(0.0),
);
@ -388,7 +388,7 @@ impl FunctionEntry {
self.back_data
.clone()
.to_line()
.stroke(egui::Stroke::new(4.0, main_plot_color)),
.stroke((4.0, main_plot_color)),
);
}
@ -430,7 +430,7 @@ impl FunctionEntry {
Some(integral_data) => {
if integral_step > step {
plot_ui.bar_chart(
BarChart::new(integral_data.0.clone())
BarChart::new("integral", integral_data.0.clone())
.color(Color32::BLUE)
.width(integral_step),
);

View File

@ -4,7 +4,7 @@ use crate::{
misc::{create_id, get_u64_id, random_u64},
widgets::widgets_ontop,
};
use egui::{Button, Id, Key, Modifiers, TextEdit, WidgetText};
use egui::{Button, Id, Key, Modifiers, Popup, TextEdit, WidgetText};
use emath::vec2;
use parsing::Movement;
use serde::ser::SerializeStruct;
@ -151,46 +151,36 @@ impl FunctionManager {
if movement != Movement::Complete
&& let Some(hints) = function.autocomplete.hint.many()
{
// Doesn't need to have a number in id as there should only be 1 autocomplete popup in the entire gui
// hashed "autocomplete_popup"
const POPUP_ID: Id = create_id(7574801616484505465);
let mut clicked = false;
let selected_i = function.autocomplete.i;
egui::popup_below_widget(ui, POPUP_ID, &re, |ui| {
if let Some(popup_response) = Popup::menu(&re).show(|ui| {
hints.iter().enumerate().for_each(|(i, candidate)| {
if ui
.selectable_label(i == function.autocomplete.i, *candidate)
.selectable_label(i == selected_i, *candidate)
.clicked()
{
clicked = true;
function.autocomplete.i = i;
}
});
});
if clicked {
function
.autocomplete
.apply_hint(hints[function.autocomplete.i]);
// Don't need this here as it simply won't be display next frame
// ui.memory_mut().close_popup();
movement = Movement::Complete;
} else {
ui.memory_mut(|x| x.open_popup(POPUP_ID));
}) {
if clicked {
function
.autocomplete
.apply_hint(hints[function.autocomplete.i]);
movement = Movement::Complete;
}
}
}
// Push cursor to end if needed
if movement == Movement::Complete {
let mut state =
unsafe { TextEdit::load_state(ui.ctx(), te_id).unwrap_unchecked() };
let ccursor = egui::text::CCursor::new(function.autocomplete.string.len());
state.set_ccursor_range(Some(egui::text::CCursorRange::one(ccursor)));
TextEdit::store_state(ui.ctx(), te_id, state);
if let Some(mut state) = TextEdit::load_state(ui.ctx(), te_id) {
let ccursor = egui::text::CCursor::new(function.autocomplete.string.len());
state.cursor.set_char_range(Some(egui::text::CCursorRange::one(ccursor)));
TextEdit::store_state(ui.ctx(), te_id, state);
}
}
}

View File

@ -1,14 +1,3 @@
#![feature(const_mut_refs)]
#![feature(let_chains)]
#![feature(const_trait_impl)]
#![feature(const_fn_floating_point_arithmetic)]
#![feature(const_assume)]
#![feature(const_option_ext)]
#![feature(const_slice_index)]
#![feature(slice_split_at_unchecked)]
#![feature(inline_const)]
#![feature(const_for)]
#[macro_use]
extern crate static_assertions;
@ -62,12 +51,12 @@ cfg_if::cfg_if! {
/// Call this once from JavaScript to start your app.
#[wasm_bindgen]
pub async fn start(&self, canvas_id: &str) -> Result<(), wasm_bindgen::JsValue> {
pub async fn start(&self, canvas: web_sys::HtmlCanvasElement) -> Result<(), wasm_bindgen::JsValue> {
self.runner
.start(
canvas_id,
canvas,
eframe::WebOptions::default(),
Box::new(|cc| Box::new(math_app::MathApp::new(cc))),
Box::new(|cc| Ok(Box::new(math_app::MathApp::new(cc)))),
)
.await
}
@ -77,9 +66,16 @@ cfg_if::cfg_if! {
pub async fn start() {
tracing::info!("Starting...");
let window = web_sys::window().expect("no global window exists");
let document = window.document().expect("should have a document on window");
let canvas = document
.get_element_by_id("canvas")
.expect("should have a canvas element with id 'canvas'")
.dyn_into::<web_sys::HtmlCanvasElement>()
.expect("canvas element should be an HtmlCanvasElement");
let web_handle = WebHandle::new();
web_handle.start("canvas").await.unwrap()
web_handle.start(canvas).await.unwrap()
}
}
}

View File

@ -1,14 +1,3 @@
#![feature(const_mut_refs)]
#![feature(let_chains)]
#![feature(const_trait_impl)]
#![feature(const_fn_floating_point_arithmetic)]
#![feature(const_assume)]
#![feature(const_option_ext)]
#![feature(const_slice_index)]
#![feature(slice_split_at_unchecked)]
#![feature(inline_const)]
#![feature(const_for)]
#[macro_use]
extern crate static_assertions;
@ -22,7 +11,7 @@ mod widgets;
// For running the program natively! (Because why not?)
#[cfg(not(target_arch = "wasm32"))]
fn main() -> eframe::Result<()> {
fn main() -> eframe::Result {
let subscriber = tracing_subscriber::FmtSubscriber::builder()
.with_max_level(tracing::Level::INFO)
.finish();
@ -32,6 +21,6 @@ fn main() -> eframe::Result<()> {
eframe::run_native(
"(Yet-to-be-named) Graphing Software",
eframe::NativeOptions::default(),
Box::new(|cc| Box::new(math_app::MathApp::new(cc))),
Box::new(|cc| Ok(Box::new(math_app::MathApp::new(cc)))),
)
}

View File

@ -6,14 +6,14 @@ use crate::{
};
use eframe::App;
use egui::{
style::Margin, Button, CentralPanel, Color32, ComboBox, Context, DragValue, Frame, Key, Layout,
SidePanel, TopBottomPanel, Ui, Vec2, Window,
Button, CentralPanel, Color32, ComboBox, Context, DragValue, Frame, Key, Layout,
Panel, Ui, Vec2, Window,
};
use egui_plot::Plot;
use emath::{Align, Align2};
use epaint::Rounding;
use instant::Instant;
use epaint::{CornerRadius, Margin};
use web_time::Instant;
use itertools::Itertools;
use std::{io::Read, ops::BitXorAssign};
@ -51,7 +51,7 @@ pub struct AppSettings {
pub plot_width: usize,
}
impl const Default for AppSettings {
impl Default for AppSettings {
/// Default implementation of `AppSettings`, this is how the application starts up
fn default() -> Self {
Self {
@ -84,7 +84,7 @@ struct Opened {
pub welcome: bool,
}
impl const Default for Opened {
impl Default for Opened {
fn default() -> Opened {
Self {
help: false,
@ -183,14 +183,14 @@ impl MathApp {
fn decompress_fonts() -> epaint::text::FontDefinitions {
let mut data = Vec::new();
let _ = ruzstd::StreamingDecoder::new(
&mut const { include_bytes!(concat!(env!("OUT_DIR"), "/compressed_data")).as_slice() },
let _ = ruzstd::decoding::StreamingDecoder::new(
const { include_bytes!(concat!(env!("OUT_DIR"), "/compressed_data")).as_slice() },
)
.expect("unable to decode compressed data")
.read_to_end(&mut data)
.expect("unable to read compressed data");
#[cfg(target = "wasm32")]
#[cfg(target_arch = "wasm32")]
{
tracing::info!("Setting decompression cache");
let commit: crate::misc::HashBytes = const {
@ -213,7 +213,7 @@ impl MathApp {
// Initialize fonts
// This used to be in the `update` method, but (after a ton of digging) this actually caused OOMs. that was a pain to debug
cc.egui_ctx.set_fonts({
#[cfg(target = "wasm32")]
#[cfg(target_arch = "wasm32")]
if let Some(Ok(data)) =
get_storage_decompressed().map(|data| bincode::deserialize(data.as_slice()))
{
@ -222,7 +222,7 @@ impl MathApp {
decompress_fonts()
}
#[cfg(not(target = "wasm32"))]
#[cfg(not(target_arch = "wasm32"))]
decompress_fonts()
});
@ -251,7 +251,7 @@ impl MathApp {
fn side_panel(&mut self, ctx: &Context) {
// Side Panel which contains vital options to the operation of the application
// (such as adding functions and other options)
SidePanel::left("side_panel")
Panel::left("side_panel")
.resizable(false)
.show(ctx, |ui| {
let any_using_integral = self.functions.any_using_integral();
@ -400,7 +400,7 @@ impl App for MathApp {
fn update(&mut self, ctx: &Context, _frame: &mut eframe::Frame) {
// start timer
let start = if self.opened.info {
Some(instant::Instant::now())
Some(Instant::now())
} else {
// if disabled, clear the stored formatted time
self.last_info.1 = None;
@ -417,7 +417,7 @@ impl App for MathApp {
}
// Creates Top bar that contains some general options
TopBottomPanel::top("top_bar").show(ctx, |ui| {
Panel::top("top_bar").show(ctx, |ui| {
ui.horizontal(|ui| {
// Button in top bar to toggle showing the side panel
self.opened.side_panel.bitxor_assign(
@ -537,11 +537,11 @@ impl App for MathApp {
// Central panel which contains the central plot (or an error created when parsing)
CentralPanel::default()
.frame(Frame {
inner_margin: Margin::symmetric(0.0, 0.0),
rounding: Rounding::ZERO,
inner_margin: Margin::ZERO,
corner_radius: CornerRadius::ZERO,
// fill: crate::style::STYLE.window_fill(),
fill: Color32::from_gray(27),
..Frame::none()
..Frame::NONE
})
.show(ctx, |ui| {
// Display an error if it exists
@ -573,7 +573,7 @@ impl App for MathApp {
// Create and setup plot
Plot::new("plot")
.set_margin_fraction(Vec2::ZERO)
.set_margin_fraction(emath::Vec2::ZERO)
.data_aspect(1.0)
.include_y(0)
.show(ui, |plot_ui| {
@ -620,6 +620,6 @@ impl App for MathApp {
});
// Calculate and store the last time it took to draw the frame
self.last_info.1 = start.map(|a| format!("Took: {}ms", a.elapsed().as_micros()));
self.last_info.1 = start.map(|a| format!("Took: {}us", a.elapsed().as_micros()));
}
}

View File

@ -1,20 +1,19 @@
use egui::Id;
use egui_plot::{Line, PlotPoint, PlotPoints, Points};
use emath::Pos2;
use getrandom::getrandom;
use itertools::Itertools;
use parsing::FlatExWrapper;
/// Implements traits that are useful when dealing with Vectors of egui's `Value`
pub trait EguiHelper {
/// Converts to `egui::plot::Values`
fn to_values(self) -> PlotPoints;
fn to_values(self) -> PlotPoints<'static>;
/// Converts to `egui::plot::Line`
fn to_line(self) -> Line;
fn to_line(self) -> Line<'static>;
/// Converts to `egui::plot::Points`
fn to_points(self) -> Points;
fn to_points(self) -> Points<'static>;
/// Converts Vector of Values into vector of tuples
fn to_tuple(self) -> Vec<(f64, f64)>;
@ -22,15 +21,15 @@ pub trait EguiHelper {
impl EguiHelper for Vec<PlotPoint> {
#[inline(always)]
fn to_values(self) -> PlotPoints {
fn to_values(self) -> PlotPoints<'static> {
PlotPoints::from(unsafe { std::mem::transmute::<Vec<PlotPoint>, Vec<[f64; 2]>>(self) })
}
#[inline(always)]
fn to_line(self) -> Line { Line::new(self.to_values()) }
fn to_line(self) -> Line<'static> { Line::new("", self.to_values()) }
#[inline(always)]
fn to_points(self) -> Points { Points::new(self.to_values()) }
fn to_points(self) -> Points<'static> { Points::new("", self.to_values()) }
#[inline(always)]
fn to_tuple(self) -> Vec<(f64, f64)> {
@ -43,7 +42,7 @@ pub trait Offset {
fn offset_x(self, x_offset: f32) -> Pos2;
}
impl const Offset for Pos2 {
impl Offset for Pos2 {
fn offset_y(self, y_offset: f32) -> Pos2 {
Pos2 {
x: self.x,
@ -191,7 +190,7 @@ pub fn random_u64() -> Result<u64, getrandom::Error> {
// Buffer of 8 `u8`s that are later merged into one u64
let mut buf = [0u8; 8];
// Populate buffer with random values
getrandom(&mut buf)?;
getrandom::fill(&mut buf)?;
// Merge buffer into u64
Ok(u64::from_be_bytes(buf))
}

View File

@ -143,8 +143,9 @@ fn invalid_hashed_storage() {
fn newtons_method() {
use parsing::BackingFunction;
use parsing::FlatExWrapper;
use parsing::process_func_str;
fn get_flatexwrapper(func: &str) -> FlatExWrapper {
let mut backing_func = BackingFunction::new(func).unwrap();
let backing_func = BackingFunction::new(&process_func_str(func)).unwrap();
backing_func.get_function_derivative(0).clone()
}