Struct ExprMap
pub struct ExprMap {
pub base: Box<Expr>,
pub map: Box<Expr>,
}Expand description
A map/transform operation over a collection.
ExprMap applies a transformation expression to each item in a base
collection. Within the map expression, Expr::arg(n) refers to elements
of each item:
- For simple values,
arg(0)is the item itself. - For records,
arg(0)is field 0,arg(1)is field 1, etc.
§Examples
§Simple values
map([1, 2, 3], x => x == field)Here base is [1, 2, 3] and map is arg(0) == field.
§Records
map([{1, 2}, {3, 4}], r => r.0 + r.1)Here each item is a record with two fields. arg(0) refers to the first
field and arg(1) refers to the second field of each record.
Fields§
§base: Box<Expr>The collection expression to iterate over.
map: Box<Expr>The transformation to apply to each item. Use Expr::arg(n) to
reference elements of the current item being mapped.
Trait Implementations§
impl StructuralPartialEq for ExprMap
Auto Trait Implementations§
impl Freeze for ExprMap
impl RefUnwindSafe for ExprMap
impl Send for ExprMap
impl Sync for ExprMap
impl Unpin for ExprMap
impl UnwindSafe for ExprMap
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