reduce calls to FunctionEntry::display logic
This commit is contained in:
parent
430873789c
commit
f373662a0d
@ -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() {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user