A function declaration. For example
fn foo(x: u32) -> u64 {(x + 1).into()}
A function declaration within a trait might not have a body:
trait Trait {
fn bar();
}
INTERNAL: Do not reference the Generated::Function class directly.
Use the subclass Function, where the following predicates are available.
Import path
import codeql.rust.elements.internal.generated.FunctionDirect supertypes
Indirect supertypes
Known direct subtypes
Predicates
| getAPrimaryQlClass | Gets the name of a primary CodeQL class to which this element belongs. |
| getAbi | Gets the abi of this function, if it exists. |
| getFunctionBody | Gets the function body of this function, if it exists. |
| getGenericParamList | Gets the generic parameter list of this function, if it exists. |
| getName | Gets the name of this function, if it exists. |
| getRetType | Gets the ret type of this function, if it exists. |
| getVisibility | Gets the visibility of this function, if it exists. |
| getWhereClause | Gets the where clause of this function, if it exists. |
| hasAbi | Holds if |
| hasFunctionBody | Holds if |
| hasGenericParamList | Holds if |
| hasImplementation | Holds if this function has an implementation. |
| hasName | Holds if |
| hasRetType | Holds if |
| hasVisibility | Holds if |
| hasWhereClause | Holds if |
| isAsync | Holds if this function is async. |
| isConst | Holds if this function is const. |
| isDefault | Holds if this function is default. |
| isGen | Holds if this function is gen. |
| isUnsafe | Holds if this function is unsafe. |
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 | from Callable |
| getAttributeMacroExpansion | Gets the attribute macro expansion of this item, if it exists. | from Item |
| getBody | Gets the body of this callable, if it exists. | from Callable |
| getCanonicalPath | Gets the canonical path of this item, if any. | from Addressable |
| getCanonicalPath | Gets the canonical path of this item, if any. | from Addressable |
| 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 |
| getLocation | from 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 | from Callable |
| getParam | Gets the | 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 | 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 |
| hasAttributeMacroExpansion | Holds if | from Item |
| hasBody | Holds if | from Callable |
| hasCanonicalPath | Holds if this item has a canonical path. | from Addressable |
| hasEnclosingCfgScope | Holds if this node is inside a CFG scope. | from AstNode |
| hasParamList | Holds if | from Callable |
| hasSelfParam | Holds if | from Callable |
| implements | Holds if this item implements trait item | from AssocItem |
| 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 |
| isUnknown | from Element | |
| resolve | Gets the element that should substitute this element in the explicit AST, applying | 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 |