pub struct Expression<S = Source> {
pub sources: Vec<S>,
pub terms: Vec<Term>,
}Expand description
Fields§
§sources: Vec<S>The sources its Term::Source terms read, each once.
terms: Vec<Term>Its terms, each after the terms it reads; the last is the value.
Implementations§
Source§impl<S: Clone + PartialEq + Serialize> Expression<S>
impl<S: Clone + PartialEq + Serialize> Expression<S>
Sourcepub fn evaluate(&self, values: &[f32]) -> f32
pub fn evaluate(&self, values: &[f32]) -> f32
Its value from its sources’ values (in Expression::sources order), under the module’s numeric rules.
Sourcepub fn canonical(&self) -> Result<Expression<S>, String>
pub fn canonical(&self) -> Result<Expression<S>, String>
Its canonical spelling (see the module), or why it has none: a term reading itself or a later term, a source
that is not there, a constant that is not finite, no terms, or more than TERM_LIMIT once canonical.
Trait Implementations§
Source§impl<S: Clone> Clone for Expression<S>
impl<S: Clone> Clone for Expression<S>
Source§impl<S: Debug> Debug for Expression<S>
impl<S: Debug> Debug for Expression<S>
Source§impl<S: PartialEq> PartialEq for Expression<S>
impl<S: PartialEq> PartialEq for Expression<S>
Source§impl<S> Serialize for Expression<S>where
S: Serialize,
impl<S> Serialize for Expression<S>where
S: Serialize,
impl<S: PartialEq> StructuralPartialEq for Expression<S>
Auto Trait Implementations§
impl<S> Forget for Expression<S>
impl<S> Freeze for Expression<S>
impl<S> RefUnwindSafe for Expression<S>where
Vec<S>: RefUnwindSafe,
impl<S> Send for Expression<S>
impl<S> Sync for Expression<S>
impl<S> Unpin for Expression<S>
impl<S> UnsafeUnpin for Expression<S>where
Vec<S>: UnsafeUnpin,
impl<S> UnwindSafe for Expression<S>where
Vec<S>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more