diff --git a/src/egui_app.rs b/src/egui_app.rs index fae0a3c..5abfbac 100644 --- a/src/egui_app.rs +++ b/src/egui_app.rs @@ -279,7 +279,7 @@ impl MathApp { ); } } else { - function.func_str = String::new(); + function.empty_func_str(); } } @@ -349,7 +349,7 @@ impl epi::App for MathApp { None, // Doesn't matter, updated later Some(self.settings.sum), ); - function.func_str = String::new(); + function.empty_func_str(); function }); self.func_strs.push(String::new()); diff --git a/src/function.rs b/src/function.rs index 6a753ec..5e427d6 100644 --- a/src/function.rs +++ b/src/function.rs @@ -23,7 +23,7 @@ impl fmt::Display for RiemannSum { pub struct Function { function: Box f64>, - pub(crate) func_str: String, + func_str: String, min_x: f64, max_x: f64, pixel_width: usize, @@ -248,4 +248,6 @@ impl Function { let area: f64 = data2.iter().map(|(_, y)| y * step).sum(); // sum of all rectangles' areas (data2, area) } + + pub fn empty_func_str(&mut self) { self.func_str = String::new(); } }