Enum conjure_oxide::ast::Expression

source ·
#[non_exhaustive]
pub enum Expression {
Show 23 variants Nothing, Bubble(Metadata, Box<Expression>, Box<Expression>), Constant(Metadata, Constant), Reference(Metadata, Name), Sum(Metadata, Vec<Expression>), Min(Metadata, Vec<Expression>), Not(Metadata, Box<Expression>), Or(Metadata, Vec<Expression>), And(Metadata, Vec<Expression>), Eq(Metadata, Box<Expression>, Box<Expression>), Neq(Metadata, Box<Expression>, Box<Expression>), Geq(Metadata, Box<Expression>, Box<Expression>), Leq(Metadata, Box<Expression>, Box<Expression>), Gt(Metadata, Box<Expression>, Box<Expression>), Lt(Metadata, Box<Expression>, Box<Expression>), SafeDiv(Metadata, Box<Expression>, Box<Expression>), UnsafeDiv(Metadata, Box<Expression>, Box<Expression>), SumEq(Metadata, Vec<Expression>, Box<Expression>), SumGeq(Metadata, Vec<Expression>, Box<Expression>), SumLeq(Metadata, Vec<Expression>, Box<Expression>), DivEq(Metadata, Box<Expression>, Box<Expression>, Box<Expression>), Ineq(Metadata, Box<Expression>, Box<Expression>, Box<Expression>), AllDiff(Metadata, Vec<Expression>),
}
Expand description

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Nothing

  • Represents an empty expression
  • NB: we only expect this at the top level of a model (if there is no constraints)
§

Bubble(Metadata, Box<Expression>, Box<Expression>)

An expression representing “A is valid as long as B is true” Turns into a conjunction when it reaches a boolean context

§

Constant(Metadata, Constant)

Supported by: Minion, JsonInput.

§

Reference(Metadata, Name)

Supported by: Minion, JsonInput, SAT.

§

Sum(Metadata, Vec<Expression>)

Supported by: Minion, JsonInput.

§

Min(Metadata, Vec<Expression>)

Supported by: JsonInput.

§

Not(Metadata, Box<Expression>)

Supported by: JsonInput, SAT.

§

Or(Metadata, Vec<Expression>)

Supported by: JsonInput, SAT.

§

And(Metadata, Vec<Expression>)

Supported by: JsonInput, SAT.

§

Eq(Metadata, Box<Expression>, Box<Expression>)

Supported by: JsonInput.

§

Neq(Metadata, Box<Expression>, Box<Expression>)

Supported by: JsonInput.

§

Geq(Metadata, Box<Expression>, Box<Expression>)

Supported by: JsonInput.

§

Leq(Metadata, Box<Expression>, Box<Expression>)

Supported by: JsonInput.

§

Gt(Metadata, Box<Expression>, Box<Expression>)

Supported by: JsonInput.

§

Lt(Metadata, Box<Expression>, Box<Expression>)

Supported by: JsonInput.

§

SafeDiv(Metadata, Box<Expression>, Box<Expression>)

Division after preventing division by zero, usually with a bubble

§

UnsafeDiv(Metadata, Box<Expression>, Box<Expression>)

Division with a possibly undefined value (division by 0) Supported by: JsonInput.

§

SumEq(Metadata, Vec<Expression>, Box<Expression>)

§

SumGeq(Metadata, Vec<Expression>, Box<Expression>)

Supported by: Minion.

§

SumLeq(Metadata, Vec<Expression>, Box<Expression>)

Supported by: Minion.

§

DivEq(Metadata, Box<Expression>, Box<Expression>, Box<Expression>)

Supported by: Minion.

§

Ineq(Metadata, Box<Expression>, Box<Expression>, Box<Expression>)

Supported by: Minion.

§

AllDiff(Metadata, Vec<Expression>)

Supported by: Minion.

Implementations§

source§

impl Expression

§enum Variant Predicates

source

pub fn is_nothing(&self) -> bool

Is this Expression a Nothing?

source

pub fn is_bubble(&self) -> bool

Is this Expression a Bubble?

source

pub fn is_constant(&self) -> bool

Is this Expression a Constant?

source

pub fn is_reference(&self) -> bool

Is this Expression a Reference?

source

pub fn is_sum(&self) -> bool

Is this Expression a Sum?

source

pub fn is_min(&self) -> bool

Is this Expression a Min?

source

pub fn is_not(&self) -> bool

Is this Expression a Not?

source

pub fn is_or(&self) -> bool

Is this Expression a Or?

source

pub fn is_and(&self) -> bool

Is this Expression a And?

source

pub fn is_eq(&self) -> bool

Is this Expression a Eq?

source

pub fn is_neq(&self) -> bool

Is this Expression a Neq?

source

pub fn is_geq(&self) -> bool

Is this Expression a Geq?

source

pub fn is_leq(&self) -> bool

Is this Expression a Leq?

source

pub fn is_gt(&self) -> bool

Is this Expression a Gt?

source

pub fn is_lt(&self) -> bool

Is this Expression a Lt?

source

pub fn is_safe_div(&self) -> bool

Is this Expression a SafeDiv?

source

pub fn is_unsafe_div(&self) -> bool

Is this Expression a UnsafeDiv?

source

pub fn is_sum_eq(&self) -> bool

Is this Expression a SumEq?

source

pub fn is_sum_geq(&self) -> bool

Is this Expression a SumGeq?

source

pub fn is_sum_leq(&self) -> bool

Is this Expression a SumLeq?

source

pub fn is_div_eq(&self) -> bool

Is this Expression a DivEq?

source

pub fn is_ineq(&self) -> bool

Is this Expression a Ineq?

source

pub fn is_all_diff(&self) -> bool

Is this Expression a AllDiff?

source§

impl Expression

source

pub fn domain_of( &self, vars: &HashMap<Name, DecisionVariable>, ) -> Option<Domain>

Returns the possible values of the expression, recursing to leaf expressions

source

pub fn can_be_undefined(&self) -> bool

source

pub fn return_type(&self) -> Option<ReturnType>

source

pub fn is_clean(&self) -> bool

source

pub fn set_clean(&mut self, bool_value: bool)

Trait Implementations§

source§

impl Clone for Expression

source§

fn clone(&self) -> Expression

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Expression

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Expression

source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Expression, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Expression

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl From<bool> for Expression

source§

fn from(b: bool) -> Expression

Converts to this type from the input type.
source§

impl From<i32> for Expression

source§

fn from(i: i32) -> Expression

Converts to this type from the input type.
source§

impl PartialEq for Expression

source§

fn eq(&self, other: &Expression) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Expression

source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Uniplate for Expression

source§

fn uniplate( &self, ) -> (Tree<Expression>, Box<dyn Fn(Tree<Expression>) -> Expression>)

source§

fn descend(&self, op: Arc<dyn Fn(Self) -> Self>) -> Self

source§

fn universe(&self) -> Vector<Self>

Gest all children of a node, including itself and all children.
source§

fn children(&self) -> Vector<Self>

Gets the direct children (maximal substructures) of a node.
source§

fn with_children(&self, children: Vector<Self>) -> Self

Reconstructs the node with the given children. Read more
source§

fn transform(&self, f: Arc<dyn Fn(Self) -> Self>) -> Self

Applies the given rule to all nodes bottom up.
source§

fn rewrite(&self, f: Arc<dyn Fn(Self) -> Option<Self>>) -> Self

Rewrites by applying a rule everywhere it can.
source§

fn cata<T>(&self, op: Arc<dyn Fn(Self, Vec<T>) -> T>) -> T

Performs a fold-like computation on each value. Read more
source§

impl Eq for Expression

source§

impl StructuralPartialEq for Expression

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,