Struct exmex::OwnedFlatEx [−][src]
pub struct OwnedFlatEx<T, OF = DefaultOpsFactory<T>> where
T: Clone + Debug,
OF: MakeOperators<T>, { /* fields omitted */ }Expand description
This is another representation of a flattened expression besides FlatEx.
The difference is that OwnedFlatEx can be used without
a lifetime parameter. All the data that FlatEx borrowed is kept in a
buffer by OwnedFlatEx. The drawback is that parsing takes longer, since
additional allocations are necessary. Evaluation time should be about the same for
FlatEx and OwnedFlatEx.
use exmex::{Express, OwnedFlatEx};
let to_be_parsed = "log(z) + 2* (-z^(x-2) + sin(4*y))";
let expr_owned = OwnedFlatEx::<f64>::from_str(to_be_parsed)?;
assert!((expr_owned.eval(&[4.0, 3.7, 2.5])? - 14.992794866624788 as f64).abs() < 1e-12);Implementations
Creates an OwnedFlatEx instance from an instance of FlatEx.
Trait Implementations
impl<T: Clone, OF: Clone> Clone for OwnedFlatEx<T, OF> where
T: Clone + Debug,
OF: MakeOperators<T>,
impl<T: Clone, OF: Clone> Clone for OwnedFlatEx<T, OF> where
T: Clone + Debug,
OF: MakeOperators<T>,
impl<T: Debug, OF: Debug> Debug for OwnedFlatEx<T, OF> where
T: Clone + Debug,
OF: MakeOperators<T>,
impl<T: Debug, OF: Debug> Debug for OwnedFlatEx<T, OF> where
T: Clone + Debug,
OF: MakeOperators<T>,
The expression is displayed as a string created by unparse.
Parses a string into an expression that can be evaluated. Read more
Use custom number literals defined as regex patterns to create an expression that can be evaluated. Read more
Evaluates an expression with the given variable values and returns the computed result. Read more
This method computes a new instance that is a partial derivative of
self with default operators. Read more
Creates an expression string that corresponds to the FlatEx instance. This is
not necessarily the input string. More precisely, Read more
impl<T: PartialEq, OF: PartialEq> PartialEq<OwnedFlatEx<T, OF>> for OwnedFlatEx<T, OF> where
T: Clone + Debug,
OF: MakeOperators<T>,
impl<T: PartialEq, OF: PartialEq> PartialEq<OwnedFlatEx<T, OF>> for OwnedFlatEx<T, OF> where
T: Clone + Debug,
OF: MakeOperators<T>,
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
impl<T: PartialOrd, OF: PartialOrd> PartialOrd<OwnedFlatEx<T, OF>> for OwnedFlatEx<T, OF> where
T: Clone + Debug,
OF: MakeOperators<T>,
impl<T: PartialOrd, OF: PartialOrd> PartialOrd<OwnedFlatEx<T, OF>> for OwnedFlatEx<T, OF> where
T: Clone + Debug,
OF: MakeOperators<T>,
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
impl<T, OF> StructuralPartialEq for OwnedFlatEx<T, OF> where
T: Clone + Debug,
OF: MakeOperators<T>,
Auto Trait Implementations
impl<T, OF> RefUnwindSafe for OwnedFlatEx<T, OF> where
OF: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, OF> Send for OwnedFlatEx<T, OF> where
OF: Send,
T: Send,
impl<T, OF> Sync for OwnedFlatEx<T, OF> where
OF: Sync,
T: Sync,
impl<T, OF> Unpin for OwnedFlatEx<T, OF> where
OF: Unpin,
T: Unpin,
impl<T, OF> UnwindSafe for OwnedFlatEx<T, OF> where
OF: UnwindSafe,
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more