#[non_exhaustive]pub struct ForExpr {
pub binders: Vec<Arc<str>>,
pub collection: Box<Expression>,
pub key: Option<Box<Expression>>,
pub value: Box<Expression>,
pub cond: Option<Box<Expression>>,
pub object_form: bool,
pub span: Span,
}Expand description
An HCL for comprehension — captured verbatim when the evaluator cannot
reduce it (typically because the source collection is unresolved).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.binders: Vec<Arc<str>>Iteration variable name(s): [key, value] if a key was bound, else
[value].
collection: Box<Expression>Source collection.
key: Option<Box<Expression>>Yielded key expression (object form only).
value: Box<Expression>Yielded value expression.
cond: Option<Box<Expression>>Optional if clause.
object_form: boolWhether this is an object comprehension ({...}) vs. a list one ([...]).
span: SpanSpan.
Implementations§
Source§impl ForExpr
impl ForExpr
Sourcepub fn builder() -> ForExprBuilder<((), (), (), (), (), (), ())>
pub fn builder() -> ForExprBuilder<((), (), (), (), (), (), ())>
Create a builder for building ForExpr.
On the builder, call .binders(...), .collection(...), .key(...)(optional), .value(...), .cond(...)(optional), .object_form(...)(optional), .span(...) to set the values of the fields.
Finally, call .build() to create the instance of ForExpr.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ForExpr
impl<'de> Deserialize<'de> for ForExpr
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
impl StructuralPartialEq for ForExpr
Auto Trait Implementations§
impl Freeze for ForExpr
impl RefUnwindSafe for ForExpr
impl Send for ForExpr
impl Sync for ForExpr
impl Unpin for ForExpr
impl UnsafeUnpin for ForExpr
impl UnwindSafe for ForExpr
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