better handling of setting func_str to an empty string
This commit is contained in:
parent
43fe4e64af
commit
68322f37db
@ -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());
|
||||
|
||||
@ -23,7 +23,7 @@ impl fmt::Display for RiemannSum {
|
||||
|
||||
pub struct Function {
|
||||
function: Box<dyn Fn(f64) -> 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(); }
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user