pub struct Expr {
pub kind: ExprKind,
pub span: Span,
}Expand description
Fields§
§kind: ExprKindThe kind of expression.
span: SpanSource span.
Implementations§
Source§impl Expr
impl Expr
Sourcepub fn child_count(&self) -> usize
pub fn child_count(&self) -> usize
Return the number of direct child expressions.
Only counts immediate children, not transitive descendants.
Leaf nodes (literals, identifiers, NaLit) return 0.
For Call expressions the count includes both the callee and all arguments.
§Returns
The number of direct child expression sub-trees.
Sourcepub fn is_literal(&self) -> bool
pub fn is_literal(&self) -> bool
Return true if this expression is a literal value.
Covers integer, float, string (including byte-string, raw-string, and
raw-byte-string variants), boolean, NA, and regex literals.
Collection literals (ArrayLit, TupleLit, TensorLit) are not
considered literals by this method because they contain sub-expressions.
Sourcepub fn is_place(&self) -> bool
pub fn is_place(&self) -> bool
Return true if this expression is a valid assignment target (place expression).
Place expressions are identifiers, field accesses, and index accesses. These are the only forms that may appear on the left-hand side of an assignment.
Sourcepub fn is_compound(&self) -> bool
pub fn is_compound(&self) -> bool
Return true if this expression is a compound (non-leaf) expression.
Compound expressions contain sub-expressions that require recursive evaluation: binary/unary operations, calls, matches, if-expressions, blocks, pipes, and lambdas.