reduce calls to FunctionEntry::display logic

This commit is contained in:
Simon Gardling 2022-05-07 03:22:57 -04:00
parent 430873789c
commit f373662a0d
2 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,8 @@ impl FlatExWrapper {
const fn new(f: FlatEx<f64>) -> Self { Self { func: Some(f) } }
const fn is_none(&self) -> bool { self.func.is_none() }
fn eval(&self, x: &[f64]) -> f64 {
self.func
.as_ref()
@ -71,6 +73,8 @@ impl BackingFunction {
nth_derivative: None,
};
pub fn is_none(&self) -> bool { self.function.is_none() }
/// Create new [`BackingFunction`] instance
pub fn new(func_str: &str) -> Result<Self, String> {
if func_str.is_empty() {

View File

@ -383,7 +383,7 @@ impl FunctionEntry {
pub fn display(
&self, plot_ui: &mut PlotUi, settings: &AppSettings, main_plot_color: Color32,
) -> Option<f64> {
if self.test_result.is_some() {
if self.test_result.is_some() | self.function.is_none() {
return None;
}