pub enum ArrayNode {
Size(ArrayId),
Elem {
array: ArrayId,
index: Box<Expr>,
ty: Ty,
},
Loop(LoopId, Ty),
Foreach {
array: ArrayId,
var: LoopId,
body: Box<Expr>,
},
Reduce {
op: ReduceOp,
array: ArrayId,
var: LoopId,
index_var: LoopId,
body: Box<Expr>,
},
Call {
func: FuncId,
args: Vec<Expr>,
ty: Ty,
},
Pick {
index: Box<Expr>,
low: i64,
elems: Vec<Expr>,
ty: Ty,
},
Distinct {
scalars: Vec<Expr>,
arrays: Vec<ArrayId>,
},
RowScope {
template: ArrayId,
row: Box<Expr>,
body: Box<Expr>,
},
}Expand description
The array-level IR nodes (see Expr::Array).
Variants§
Size(ArrayId)
A.size(): the array’s length, s[32].
Elem
A[index] (LRM 18.5.7.1). After loop-variable substitution the index
must be free of random variables (the builder rejects the rest).
Fields
Loop(LoopId, Ty)
The current value of a foreach loop variable or reduction iterator.
Foreach
foreach (A[i]) body: body holds for every index i of A. One
bit. The body reads the index as Loop(var, s[32]).
Fields
Reduce
A.op() with (body): the reduction of body over every element,
read as Loop(var, elem_ty) for the item and Loop(idx, s[32]) for
item.index. The body’s type is the result type.
Fields
Call
A call of a user function (LRM 18.5.11), func indexing the program’s
function table (super::func). Like the nodes above it is resolved
before the solver sees the tree: once its arguments are constants the
call is evaluated and replaced by the constant it returns (the return
value is a state variable of the constraint that holds it).
Fields
Pick
A[index] over a fixed-size unpacked array held in a class property
(LRM 7.4, 18.4): every element is its own variable or state, and the
element read is the one the index names. The index is a constant, a state
or a loop variable, so it is known once the node is expanded; only the
chosen element is expanded, so an index outside the array is an error
only when this node is live (LRM 18.5.7.1: the user excludes such indices
with a guard).
Fields
Distinct
unique { m0, m1, ... } (LRM 18.5.4) whose group holds a whole
dynamic array or queue, whose length is known only at run time: true
iff no two of the scalars and of every element of every array in
arrays hold the same value. One bit. Expansion replaces it with the
Expr::AllDistinct over the scalars followed by each array’s
elements (a group of fewer than two members is simply true).
Fields
RowScope
body read with the row array template standing for row row of the
array of arrays that template is the row template of (LRM 18.4, 7.4.5:
a[i].size, a[i][j], a[i].sum() over rand int a[][]). The row
arrays of an array of dynamic arrays or queues are not known when the
constraints are built (the outer size is solved first, then every row
gets its own size and elements), so body is ordinary one-dimensional
array IR over template, and expansion rebinds template to the
concrete row array of the row row names once the outer size is fixed
(super::array::lower_rows). row is free of random variables, like
an element index.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ArrayNode
impl<'de> Deserialize<'de> for ArrayNode
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>,
impl Eq for ArrayNode
impl StructuralPartialEq for ArrayNode
Auto Trait Implementations§
impl Freeze for ArrayNode
impl RefUnwindSafe for ArrayNode
impl Send for ArrayNode
impl Sync for ArrayNode
impl Unpin for ArrayNode
impl UnsafeUnpin for ArrayNode
impl UnwindSafe for ArrayNode
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.