From d7b88c013632d9c46e3053e183ee9c82a6bad797 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Wed, 25 May 2022 10:59:09 -0400 Subject: [PATCH] inline FlatExWrapper methods --- parsing/src/parsing.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/parsing/src/parsing.rs b/parsing/src/parsing.rs index d8390d1..ebb263a 100644 --- a/parsing/src/parsing.rs +++ b/parsing/src/parsing.rs @@ -8,10 +8,13 @@ pub(crate) struct FlatExWrapper { impl FlatExWrapper { const EMPTY: FlatExWrapper = FlatExWrapper { func: None }; + #[inline] const fn new(f: FlatEx) -> Self { Self { func: Some(f) } } + #[inline] const fn is_none(&self) -> bool { self.func.is_none() } + #[inline] fn eval(&self, x: &[f64]) -> f64 { self.func .as_ref() @@ -19,6 +22,7 @@ impl FlatExWrapper { .unwrap_or(f64::NAN) } + #[inline] fn partial(&self, x: usize) -> Self { self.func .as_ref() @@ -26,8 +30,10 @@ impl FlatExWrapper { .unwrap_or(Self::EMPTY) } + #[inline] fn get_string(&self) -> &str { self.func.as_ref().map(|f| f.unparse()).unwrap_or("") } + #[inline] fn partial_iter(&self, x: &[usize]) -> Self { self.func .as_ref()