diff --git a/src/consts.rs b/src/consts.rs index b72eea0..c2bbfb0 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -1,4 +1,3 @@ -use crate::function_entry::Riemann; use std::ops::RangeInclusive; use const_format::formatc; @@ -34,10 +33,6 @@ const_assert!(INTEGRAL_X_MAX > INTEGRAL_X_MIN); pub const INTEGRAL_X_RANGE: RangeInclusive = INTEGRAL_X_MIN..=INTEGRAL_X_MAX; // Default values - -/// Default Riemann Sum to calculate -pub const DEFAULT_RIEMANN: Riemann = Riemann::Left; - /// Default minimum X value to display pub const DEFAULT_MIN_X: f64 = -10.0; diff --git a/src/function_entry.rs b/src/function_entry.rs index d516c4f..8844d9f 100644 --- a/src/function_entry.rs +++ b/src/function_entry.rs @@ -32,6 +32,10 @@ impl fmt::Display for Riemann { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self) } } +impl const Default for Riemann { + fn default() -> Riemann { Riemann::Left } +} + /// `FunctionEntry` is a function that can calculate values, integrals, derivatives, etc etc #[derive(PartialEq, Clone)] pub struct FunctionEntry { diff --git a/src/math_app.rs b/src/math_app.rs index a27ed34..1caa5fe 100644 --- a/src/math_app.rs +++ b/src/math_app.rs @@ -53,7 +53,7 @@ impl const Default for AppSettings { /// Default implementation of `AppSettings`, this is how the application starts up fn default() -> Self { Self { - riemann_sum: DEFAULT_RIEMANN, + riemann_sum: Riemann::default(), integral_min_x: DEFAULT_MIN_X, integral_max_x: DEFAULT_MAX_X, min_x: 0.0,