remove some explicit inline declarations

This commit is contained in:
Simon Gardling 2022-02-28 10:35:23 -05:00
parent 6b500292a3
commit 6d4bd0b8ae
3 changed files with 0 additions and 15 deletions

View File

@ -35,7 +35,6 @@ pub struct MathApp {
}
impl Default for MathApp {
#[inline]
fn default() -> Self {
let def_min_x = -10.0;
let def_max_x = 10.0;

View File

@ -11,13 +11,10 @@ pub struct FunctionOutput {
}
impl FunctionOutput {
#[inline]
pub fn new(back: Vec<Value>, front: Option<(Vec<Bar>, f64)>) -> Self { Self { back, front } }
#[inline]
pub fn get_back(&self) -> Vec<Value> { self.back.clone() }
#[inline]
pub fn get_front(&self) -> (Vec<Bar>, f64) {
match &self.front {
Some(x) => (x.0.clone(), x.1),
@ -25,7 +22,6 @@ impl FunctionOutput {
}
}
#[inline]
pub fn has_integral(&self) -> bool { self.front.is_some() }
}
@ -105,10 +101,8 @@ impl Function {
}
// Runs the internal function to get values
#[inline]
fn run_func(&self, x: f64) -> f64 { (self.function)(x) }
#[inline(always)]
pub fn update(
&mut self, func_str: String, integral: bool, integral_min_x: Option<f64>,
integral_max_x: Option<f64>, integral_num: Option<usize>,
@ -159,7 +153,6 @@ impl Function {
}
}
#[inline(always)]
pub fn update_bounds(&mut self, min_x: f64, max_x: f64, pixel_width: usize) {
if pixel_width != self.pixel_width {
self.back_cache = None;
@ -170,7 +163,6 @@ impl Function {
&& self.back_cache.is_some()
&& false
{
println!("rebuilding cache");
let range_new: f64 = max_x.abs() + min_x.abs();
let resolution: f64 = (self.pixel_width as f64 / range_new) as f64;
@ -207,15 +199,12 @@ impl Function {
}
}
#[inline]
pub fn get_step(&self) -> f64 {
(self.integral_min_x - self.integral_max_x).abs() / (self.integral_num as f64)
}
#[inline]
pub fn is_integral(&self) -> bool { self.integral }
#[inline(always)]
pub fn run(&mut self) -> FunctionOutput {
let front_values: Vec<Value> = match self.back_cache.is_some() {
true => self.back_cache.as_ref().expect("").clone(),

View File

@ -5,7 +5,6 @@ EXTREMELY Janky function that tries to put asterisks in the proper places to be
One limitation though, variables with multiple characters like `pi` cannot be multiplied (like `pipipipi` won't result in `pi*pi*pi*pi`). But that's such a niche use case (and that same thing could be done by using exponents) that it doesn't really matter.
In the future I may want to completely rewrite this or implement this natively into mevel-rs (which would probably be good to do)
*/
#[inline]
pub fn add_asterisks(function_in: String) -> String {
let function = function_in.replace("log10(", "log(").replace("pi", "π"); // pi -> π and log10 -> log
let valid_variables: Vec<char> = "xeπ".chars().collect();
@ -79,7 +78,6 @@ pub fn add_asterisks(function_in: String) -> String {
}
// Tests function to make sure it's able to be parsed. Returns the string of the Error produced, or an empty string if it runs successfully.
#[inline]
pub fn test_func(function_string: String) -> String {
// Factorials do not work, and it would be really difficult to make them work
if function_string.contains('!') {
@ -110,7 +108,6 @@ pub fn test_func(function_string: String) -> String {
}
// Rounds f64 to specific number of digits
#[inline]
pub fn digits_precision(x: f64, digits: usize) -> f64 {
let large_number: f64 = 10.0_f64.powf(digits as f64);
(x * large_number).round() / large_number