Module builder

Module builder 

Source
Expand description

Fluent functions for constructing AST nodes program by programmatically.

These functions leverage the From trait implementations defined in ast.rs to allow users to pass primitive types directly as arguments where an Expr is expected.

Functionsยง

add
Creates an Expr::BinaryOp node with the BinaryOperator::Add operator.
and
Creates an Expr::BinaryOp node with the BinaryOperator::And operator.
call
Creates an Expr::Call node.
comprehension
Creates an Expr::Comprehension node (e.g., list.all(i, i > 0)).
conditional
Creates an Expr::Conditional node (ternary operator).
div
Creates an Expr::BinaryOp node with the BinaryOperator::Div operator.
eq
Creates an Expr::BinaryOp node with the BinaryOperator::Eq operator.
field_access
Creates an Expr::FieldAccess node (e.g., base.field).
ge
Creates an Expr::BinaryOp node with the BinaryOperator::Ge operator.
gt
Creates an Expr::BinaryOp node with the BinaryOperator::Gt operator.
has
Creates an Expr::Has macro node.
ident
Creates an Expr::Identifier node.
in
Creates an Expr::BinaryOp node with the BinaryOperator::In operator.
index
Creates an Expr::Index node (e.g., base[index]).
le
Creates an Expr::BinaryOp node with the BinaryOperator::Le operator.
list
Creates an Expr::List node.
lit
Creates an Expr::Literal node from any type implementing Into<Literal>.
lt
Creates an Expr::BinaryOp node with the BinaryOperator::Lt operator.
map
Creates an Expr::MapLiteral node.
map_macro
Creates an Expr::Map macro node.
mul
Creates an Expr::BinaryOp node with the BinaryOperator::Mul operator.
ne
Creates an Expr::BinaryOp node with the BinaryOperator::Ne operator.
neg
Creates an Expr::UnaryOp node with the Neg operator (-).
not
Creates an Expr::UnaryOp node with the Not operator (!).
null
Creates an Expr::Literal(Literal::Null) node.
or
Creates an Expr::BinaryOp node with the BinaryOperator::Or operator.
rem
Creates an Expr::BinaryOp node with the BinaryOperator::Rem operator.
sub
Creates an Expr::BinaryOp node with the BinaryOperator::Sub operator.