Enum vector_expr::Expression
source · pub enum Expression {
Boolean(BoolExpression),
Real(RealExpression),
String(StringExpression),
}
Expand description
Top-level parseable calculation.
Variants§
Implementations§
source§impl Expression
impl Expression
sourcepub fn unwrap_real(self) -> RealExpression
pub fn unwrap_real(self) -> RealExpression
Assume this expression is real-valued.
sourcepub fn unwrap_string(self) -> StringExpression
pub fn unwrap_string(self) -> StringExpression
Assume this expression is string-valued.
sourcepub fn unwrap_bool(self) -> BoolExpression
pub fn unwrap_bool(self) -> BoolExpression
Assume this expression is boolean-valued.
pub fn parse_real_variable_names( input: &str ) -> Result<HashSet<String>, ParseError>
pub fn parse_string_variable_names( input: &str ) -> Result<HashSet<String>, ParseError>
sourcepub fn parse(
input: &str,
binding_map: impl Fn(&str) -> BindingId
) -> Result<Self, ParseError>
pub fn parse( input: &str, binding_map: impl Fn(&str) -> BindingId ) -> Result<Self, ParseError>
Parse the expression from input
.
binding_map
determines which variable name maps to each data binding.
As variable names are encountered during parsing, they are replaced by
BindingId
s in the Expression
syntax tree. This allows the
Expression
to be efficiently reused with many different data
bindings.
Trait Implementations§
source§impl Clone for Expression
impl Clone for Expression
source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
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