CodeQL library for Rust
codeql/rust-all 0.2.22 (changelog, source)
Search

Class Impl::ClosureExpr

A closure expression. For example:

|x| x + 1;
move |x: i32| -> i32 { x + 1 };
async |x: i32, y| x + y;
#[coroutine]
|x| yield x;
#[coroutine]
static |x| yield x;
for<T: std::fmt::Debug> |x: T| {
    println!("{:?}", x);
};

Import path

import codeql.rust.elements.internal.ClosureExprImpl

Direct supertypes

Indirect supertypes

Predicates

getBody

Gets the body of this callable, if it exists.

toStringImpl

INTERNAL: Do not use.

Inherited predicates

fromSource

Holds if this element is from source code.

from Locatable
getACfgNode

Gets a control flow node for this AST node, if any.

from AstNode
getAParam

Gets any of the parameters of this callable.

from Callable
getAPrimaryQlClass

Gets the name of a primary CodeQL class to which this element belongs.

from ClosureExpr
getAnAttr

Gets any of the attrs of this callable.

from Callable
getAttr

Gets the indexth attr of this callable (0-based).

from Callable
getClosureBody

Gets the closure body of this closure expression, if it exists.

from ClosureExpr
getEnclosingBlock

Gets the block that encloses this node, if any.

from AstNode
getEnclosingCallable

Gets the immediately enclosing callable of this node, if any.

from AstNode
getEnclosingCfgScope

Gets the CFG scope that encloses this node, if any.

from AstNode
getFile

Gets the primary file where this element occurs.

from Locatable
getForBinder

Gets the for binder of this closure expression, if it exists.

from ClosureExpr
getLocationfrom Locatable
getNumberOfAttrs

Gets the number of attrs of this callable.

from Callable
getNumberOfParams

Gets the number of parameters of this callable.

from Callable
getNumberOfParamsInclSelf

Gets the number of parameters of this callable, including self if it exists.

from Callable
getParam

Gets the indexth parameter of this callable (0-based).

from Callable
getParamList

Gets the parameter list of this callable, if it exists.

from Callable
getParentNode

Gets the nearest enclosing parent of this node, which is also an AstNode, if any.

from AstNode
getPrimaryQlClasses

Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs.

from Element
getResolveStep

Gets the most immediate element that should substitute this element in the explicit AST, if any. Classes can override this to indicate this node should be in the “hidden” AST, mostly reserved for conversions and syntactic sugar nodes like parentheses.

from Element
getRetType

Gets the ret type of this closure expression, if it exists.

from ClosureExpr
getSelfParam

Gets the self parameter of this callable, if it exists.

from Callable
hasBody

Holds if getBody() exists.

from Callable
hasClosureBody

Holds if getClosureBody() exists.

from ClosureExpr
hasEnclosingCfgScope

Holds if this node is inside a CFG scope.

from AstNode
hasForBinder

Holds if getForBinder() exists.

from ClosureExpr
hasParamList

Holds if getParamList() exists.

from Callable
hasRetType

Holds if getRetType() exists.

from ClosureExpr
hasSelfParam

Holds if getSelfParam() exists.

from Callable
isAsync

Holds if this closure expression is async.

from ClosureExpr
isConst

Holds if this closure expression is const.

from ClosureExpr
isFromMacroExpansion

Holds if this node exists only as the result of a macro expansion.

from AstNode
isGen

Holds if this closure expression is gen.

from ClosureExpr
isInMacroExpansion

Holds if this node is inside a macro expansion.

from AstNode
isMove

Holds if this closure expression is move.

from ClosureExpr
isStatic

Holds if this closure expression is static.

from ClosureExpr
isUnknownfrom Element
resolve

Gets the element that should substitute this element in the explicit AST, applying getResolveStep transitively.

from Element
toAbbreviatedString

INTERNAL: Do not use.

from Element
toString

Gets the string representation of this element.

from Element