rustfmt
This commit is contained in:
parent
7a00ed62f6
commit
1dc42105f2
@ -233,9 +233,7 @@ impl ChartManager {
|
||||
|
||||
// Creates and does the math for creating all the rectangles under the graph
|
||||
#[inline]
|
||||
fn integral_rectangles(
|
||||
&self, step: f32
|
||||
) -> (Vec<(f32, f32, f32)>, f32) {
|
||||
fn integral_rectangles(&self, step: f32) -> (Vec<(f32, f32, f32)>, f32) {
|
||||
let data2: Vec<(f32, f32, f32)> = (0..self.num_interval)
|
||||
.map(|e| {
|
||||
let x: f32 = ((e as f32) * step) + self.min_x;
|
||||
|
||||
20
src/misc.rs
20
src/misc.rs
@ -1,5 +1,5 @@
|
||||
use wasm_bindgen::prelude::*;
|
||||
use meval::Expr;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
pub type DrawResult<T> = Result<T, Box<dyn std::error::Error>>;
|
||||
|
||||
@ -90,7 +90,7 @@ pub fn add_asterisks(function_in: String) -> String {
|
||||
|
||||
pub struct Function {
|
||||
function: Box<dyn Fn(f64) -> f64>,
|
||||
func_str: String
|
||||
func_str: String,
|
||||
}
|
||||
|
||||
impl Function {
|
||||
@ -99,24 +99,17 @@ impl Function {
|
||||
let func = expr.bind("x").unwrap();
|
||||
Self {
|
||||
function: Box::new(func),
|
||||
func_str
|
||||
func_str,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn run(&self, x: f32) -> f32 {
|
||||
(self.function)(x as f64) as f32
|
||||
}
|
||||
pub fn run(&self, x: f32) -> f32 { (self.function)(x as f64) as f32 }
|
||||
|
||||
pub fn str_compare(&self, other_string: String) -> bool {
|
||||
self.func_str == other_string
|
||||
}
|
||||
pub fn str_compare(&self, other_string: String) -> bool { self.func_str == other_string }
|
||||
|
||||
pub fn get_string(&self) -> String {
|
||||
self.func_str.clone()
|
||||
pub fn get_string(&self) -> String { self.func_str.clone() }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Result of screen to chart coordinates conversion.
|
||||
#[wasm_bindgen]
|
||||
@ -211,7 +204,6 @@ fn asterisk_test() {
|
||||
assert_eq!(&add_asterisks("x!".to_string()), "x!");
|
||||
}
|
||||
|
||||
|
||||
// Tests cache when initialized with value
|
||||
#[test]
|
||||
fn cache_test_full() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user