pub enum Expression {
Primitive(ExpressionPrimitive),
VarRef(ExpressionVarRef),
ConstructorApp(ExpressionConstructorApp),
Operator(ExpressionOperator),
Iterator(ExpressionIterator),
Projection(ExpressionProjection),
}
Expand description
Defines an eFLINT expression that evaluates to a value.
There are multiple variants of this:
- Primitives: Constants/Literals;
- Variable references: References to quantified variables;
- Construction applications: Instantiation of a type of some kind;
- Operators: Addition, substraction, multiplication, etc.;
- Iterators: Foreach, forall, exists, etc.; and
- Projections: Field accessing of some type.
Variants§
Primitive(ExpressionPrimitive)
eFLINT primitives, i.e., literal values:
"Amy"
42
42.0
true
VarRef(ExpressionVarRef)
eFLINT variable references:
citizen
// As in second occurance in:
Foreach citizen: citizen
ConstructorApp(ExpressionConstructorApp)
Constructor applications, i.e., instantiating facts:
citizen("Amy")
Operator(ExpressionOperator)
Operators (addition, multiplication, Holds, Violated, etc):
1 + 2
Holds("Amy")
Iterator(ExpressionIterator)
Iterators that do inherent quantification.
Note that this is different from operators like Count, which do not quantify themselves but rather process an already produced instance expression.
For example:
Foreach citizen : citizen.
Forall citizen : citizen.
Exists citizen : citizen.
Projection(ExpressionProjection)
Projection:
citizen.string
Implementations§
Source§impl Expression
impl Expression
Sourcepub fn kind(&self) -> Option<ExpressionKind>
pub fn kind(&self) -> Option<ExpressionKind>
Returns the kind of this expression, whether it’s a boolean or instance expression.
§Returns
An auxillary::ExpressionKind
denoting which of the two kinds it is. If None
is returned, then this is not statically determinable (this is the case for Operators and Iterators).
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 moreSource§impl Debug for Expression
impl Debug for Expression
Source§impl<'de> Deserialize<'de> for Expression
impl<'de> Deserialize<'de> for Expression
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl EnumDebug for Expression
impl EnumDebug for Expression
Source§fn type_name() -> &'static str
fn type_name() -> &'static str
Returns the static name of the type used for EnumDebug-printing. Read more
Source§fn variant_names() -> &'static [&'static str]
fn variant_names() -> &'static [&'static str]
Returns all variants in the trait as a list of names. Read more
Source§fn variant_name(&self) -> &'static str
fn variant_name(&self) -> &'static str
Returns the static name of the variant. Read more
Source§fn variant(&self) -> EnumDebugFormatter<'_, Self>
fn variant(&self) -> EnumDebugFormatter<'_, Self>
Returns a formatter for this enum that writes its variant name. Read more
Auto Trait Implementations§
impl Freeze for Expression
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