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

Class Generated::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);
};

INTERNAL: Do not reference the Generated::ClosureExpr class directly. Use the subclass ClosureExpr, where the following predicates are available.

Import path

import codeql.rust.elements.internal.generated.ClosureExpr

Direct supertypes

Indirect supertypes

Known direct subtypes

Predicates

getAPrimaryQlClass

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

getClosureBody

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

getForBinder

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

getRetType

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

hasClosureBody

Holds if getClosureBody() exists.

hasForBinder

Holds if getForBinder() exists.

hasRetType

Holds if getRetType() exists.

isAsync

Holds if this closure expression is async.

isConst

Holds if this closure expression is const.

isGen

Holds if this closure expression is gen.

isMove

Holds if this closure expression is move.

isStatic

Holds if this closure expression is static.

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
getAnAttr

Gets any of the attrs of this callable.

from Callable
getAttr

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

from Callable
getBody

Gets the body of this callable, if it exists.

from Callable
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
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
getSelfParam

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

from Callable
hasBody

Holds if getBody() exists.

from Callable
hasEnclosingCfgScope

Holds if this node is inside a CFG scope.

from AstNode
hasParamList

Holds if getParamList() exists.

from Callable
hasSelfParam

Holds if getSelfParam() exists.

from Callable
isFromMacroExpansion

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

from AstNode
isInMacroExpansion

Holds if this node is inside a macro expansion.

from AstNode
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
toStringImpl

INTERNAL: Do not use.

from Element