pub struct GraphBuildHelper<'a> { /* private fields */ }Expand description
Helper for building graphs in GraphBuilder implementations.
Provides high-level abstractions over StagingGraph that handle:
- String interning with local ID tracking
- Qualified name deduplication
- Node and edge creation with proper types
Implementations§
Source§impl<'a> GraphBuildHelper<'a>
impl<'a> GraphBuildHelper<'a>
Sourcepub fn new(
staging: &'a mut StagingGraph,
file: &Path,
language: Language,
) -> Self
pub fn new( staging: &'a mut StagingGraph, file: &Path, language: Language, ) -> Self
Create a new helper for the given staging graph and file.
The file_id should be pre-allocated by the caller (typically 0 for
per-file staging buffers).
Sourcepub fn with_file_id(
staging: &'a mut StagingGraph,
file: &Path,
language: Language,
file_id: FileId,
) -> Self
pub fn with_file_id( staging: &'a mut StagingGraph, file: &Path, language: Language, file_id: FileId, ) -> Self
Create a helper with a specific file ID.
Sourcepub fn lookup_node(&self, name: &str, kind: NodeKind) -> Option<NodeId>
pub fn lookup_node(&self, name: &str, kind: NodeKind) -> Option<NodeId>
Look up a node ID by its qualified name and kind from the internal cache.
Returns the NodeId if a node with the given (name, kind) pair was
previously created through this helper. This is used by macro boundary
analysis to find graph nodes corresponding to AST items.
Sourcepub fn attach_body_hashes(&mut self, content: &[u8])
pub fn attach_body_hashes(&mut self, content: &[u8])
Attach body hashes to all staged nodes using the given content bytes.
Multi-language plugins (Vue, Svelte) should call this per extracted script block so that node body spans — which are relative to the block content, not the full SFC file — produce correct hashes. Nodes that already have a hash are skipped, so the later whole-file call in the indexing entrypoint is harmless.
Sourcepub fn intern(&mut self, s: &str) -> StringId
pub fn intern(&mut self, s: &str) -> StringId
Intern a string and get a local StringId.
Strings are deduplicated: calling with the same value returns the same ID.
The local StringId is passed to the staging graph so that during
commit_strings(), a remap table from local to global IDs can be built.
Sourcepub fn has_node(&self, qualified_name: &str) -> bool
pub fn has_node(&self, qualified_name: &str) -> bool
Check if a node with the given qualified name already exists.
Sourcepub fn get_node(&self, qualified_name: &str) -> Option<NodeId>
pub fn get_node(&self, qualified_name: &str) -> Option<NodeId>
Get an existing node by qualified name.
Sourcepub fn has_node_with_kind(&self, qualified_name: &str, kind: NodeKind) -> bool
pub fn has_node_with_kind(&self, qualified_name: &str, kind: NodeKind) -> bool
Check if a node with the given qualified name and kind already exists.
Sourcepub fn get_node_with_kind(
&self,
qualified_name: &str,
kind: NodeKind,
) -> Option<NodeId>
pub fn get_node_with_kind( &self, qualified_name: &str, kind: NodeKind, ) -> Option<NodeId>
Get an existing node by qualified name and kind.
Sourcepub fn add_function(
&mut self,
qualified_name: &str,
span: Option<Span>,
is_async: bool,
is_unsafe: bool,
) -> NodeId
pub fn add_function( &mut self, qualified_name: &str, span: Option<Span>, is_async: bool, is_unsafe: bool, ) -> NodeId
Add a function node with the given qualified name.
Returns the NodeId (creating the node if it doesn’t exist).
Sourcepub fn add_function_with_visibility(
&mut self,
qualified_name: &str,
span: Option<Span>,
is_async: bool,
is_unsafe: bool,
visibility: Option<&str>,
) -> NodeId
pub fn add_function_with_visibility( &mut self, qualified_name: &str, span: Option<Span>, is_async: bool, is_unsafe: bool, visibility: Option<&str>, ) -> NodeId
Add a function node with visibility.
Returns the NodeId (creating the node if it doesn’t exist).
Sourcepub fn add_function_with_signature(
&mut self,
qualified_name: &str,
span: Option<Span>,
is_async: bool,
is_unsafe: bool,
visibility: Option<&str>,
signature: Option<&str>,
) -> NodeId
pub fn add_function_with_signature( &mut self, qualified_name: &str, span: Option<Span>, is_async: bool, is_unsafe: bool, visibility: Option<&str>, signature: Option<&str>, ) -> NodeId
Add a function node with signature (return type).
The signature is used for returns: queries.
Returns the NodeId (creating the node if it doesn’t exist).
Sourcepub fn add_method(
&mut self,
qualified_name: &str,
span: Option<Span>,
is_async: bool,
is_static: bool,
) -> NodeId
pub fn add_method( &mut self, qualified_name: &str, span: Option<Span>, is_async: bool, is_static: bool, ) -> NodeId
Add a method node with the given qualified name.
Sourcepub fn add_method_with_visibility(
&mut self,
qualified_name: &str,
span: Option<Span>,
is_async: bool,
is_static: bool,
visibility: Option<&str>,
) -> NodeId
pub fn add_method_with_visibility( &mut self, qualified_name: &str, span: Option<Span>, is_async: bool, is_static: bool, visibility: Option<&str>, ) -> NodeId
Add a method node with visibility.
Sourcepub fn add_method_with_signature(
&mut self,
qualified_name: &str,
span: Option<Span>,
is_async: bool,
is_static: bool,
visibility: Option<&str>,
signature: Option<&str>,
) -> NodeId
pub fn add_method_with_signature( &mut self, qualified_name: &str, span: Option<Span>, is_async: bool, is_static: bool, visibility: Option<&str>, signature: Option<&str>, ) -> NodeId
Add a method node with signature (return type).
The signature is used for returns: queries.
Returns the NodeId (creating the node if it doesn’t exist).
Sourcepub fn add_class(&mut self, qualified_name: &str, span: Option<Span>) -> NodeId
pub fn add_class(&mut self, qualified_name: &str, span: Option<Span>) -> NodeId
Add a class node.
Sourcepub fn add_class_with_visibility(
&mut self,
qualified_name: &str,
span: Option<Span>,
visibility: Option<&str>,
) -> NodeId
pub fn add_class_with_visibility( &mut self, qualified_name: &str, span: Option<Span>, visibility: Option<&str>, ) -> NodeId
Add a class node with visibility.
Sourcepub fn add_struct(&mut self, qualified_name: &str, span: Option<Span>) -> NodeId
pub fn add_struct(&mut self, qualified_name: &str, span: Option<Span>) -> NodeId
Add a struct node.
Sourcepub fn add_struct_with_visibility(
&mut self,
qualified_name: &str,
span: Option<Span>,
visibility: Option<&str>,
) -> NodeId
pub fn add_struct_with_visibility( &mut self, qualified_name: &str, span: Option<Span>, visibility: Option<&str>, ) -> NodeId
Add a struct node with visibility.
Sourcepub fn add_module(&mut self, qualified_name: &str, span: Option<Span>) -> NodeId
pub fn add_module(&mut self, qualified_name: &str, span: Option<Span>) -> NodeId
Add a module node.
Sourcepub fn add_resource(
&mut self,
qualified_name: &str,
span: Option<Span>,
) -> NodeId
pub fn add_resource( &mut self, qualified_name: &str, span: Option<Span>, ) -> NodeId
Add a resource node.
Sourcepub fn add_endpoint(
&mut self,
qualified_name: &str,
span: Option<Span>,
) -> NodeId
pub fn add_endpoint( &mut self, qualified_name: &str, span: Option<Span>, ) -> NodeId
Add an endpoint node for HTTP route handlers.
The qualified name should follow the convention route::{METHOD}::{path},
for example route::GET::/api/users or route::POST::/api/items.
Endpoint nodes are used by Pass 5 (cross-language linking) to match HTTP requests from client code to server-side route handlers.
Sourcepub fn add_import(&mut self, qualified_name: &str, span: Option<Span>) -> NodeId
pub fn add_import(&mut self, qualified_name: &str, span: Option<Span>) -> NodeId
Add an import node.
Sourcepub fn add_verbatim_import(&mut self, name: &str, span: Option<Span>) -> NodeId
pub fn add_verbatim_import(&mut self, name: &str, span: Option<Span>) -> NodeId
Add an import node while preserving the original path-like identifier.
Use this for resource imports such as styles.css, app.js, or
similar asset filenames where . is part of the path rather than a
language-native qualified-name separator.
Sourcepub fn add_variable(
&mut self,
qualified_name: &str,
span: Option<Span>,
) -> NodeId
pub fn add_variable( &mut self, qualified_name: &str, span: Option<Span>, ) -> NodeId
Add a variable node.
Sourcepub fn add_verbatim_variable(
&mut self,
name: &str,
span: Option<Span>,
) -> NodeId
pub fn add_verbatim_variable( &mut self, name: &str, span: Option<Span>, ) -> NodeId
Add a variable node while preserving the original identifier exactly.
Use this for static asset references where the literal path is the graph identity.
Sourcepub fn add_constant(
&mut self,
qualified_name: &str,
span: Option<Span>,
) -> NodeId
pub fn add_constant( &mut self, qualified_name: &str, span: Option<Span>, ) -> NodeId
Add a constant node.
Sourcepub fn add_constant_with_visibility(
&mut self,
qualified_name: &str,
span: Option<Span>,
visibility: Option<&str>,
) -> NodeId
pub fn add_constant_with_visibility( &mut self, qualified_name: &str, span: Option<Span>, visibility: Option<&str>, ) -> NodeId
Add a constant node with visibility.
Sourcepub fn add_constant_with_static_and_visibility(
&mut self,
qualified_name: &str,
span: Option<Span>,
is_static: bool,
visibility: Option<&str>,
) -> NodeId
pub fn add_constant_with_static_and_visibility( &mut self, qualified_name: &str, span: Option<Span>, is_static: bool, visibility: Option<&str>, ) -> NodeId
Add a constant node with static and visibility attributes.
Sourcepub fn add_property_with_static_and_visibility(
&mut self,
qualified_name: &str,
span: Option<Span>,
is_static: bool,
visibility: Option<&str>,
) -> NodeId
pub fn add_property_with_static_and_visibility( &mut self, qualified_name: &str, span: Option<Span>, is_static: bool, visibility: Option<&str>, ) -> NodeId
Add a property node with static and visibility attributes.
Sourcepub fn add_enum(&mut self, qualified_name: &str, span: Option<Span>) -> NodeId
pub fn add_enum(&mut self, qualified_name: &str, span: Option<Span>) -> NodeId
Add an enum node.
Sourcepub fn add_enum_with_visibility(
&mut self,
qualified_name: &str,
span: Option<Span>,
visibility: Option<&str>,
) -> NodeId
pub fn add_enum_with_visibility( &mut self, qualified_name: &str, span: Option<Span>, visibility: Option<&str>, ) -> NodeId
Add an enum node with visibility.
Sourcepub fn add_interface(
&mut self,
qualified_name: &str,
span: Option<Span>,
) -> NodeId
pub fn add_interface( &mut self, qualified_name: &str, span: Option<Span>, ) -> NodeId
Add an interface/trait node.
Sourcepub fn add_interface_with_visibility(
&mut self,
qualified_name: &str,
span: Option<Span>,
visibility: Option<&str>,
) -> NodeId
pub fn add_interface_with_visibility( &mut self, qualified_name: &str, span: Option<Span>, visibility: Option<&str>, ) -> NodeId
Add an interface/trait node with visibility.
Sourcepub fn add_type(&mut self, qualified_name: &str, span: Option<Span>) -> NodeId
pub fn add_type(&mut self, qualified_name: &str, span: Option<Span>) -> NodeId
Add a type alias node.
Sourcepub fn add_type_with_visibility(
&mut self,
qualified_name: &str,
span: Option<Span>,
visibility: Option<&str>,
) -> NodeId
pub fn add_type_with_visibility( &mut self, qualified_name: &str, span: Option<Span>, visibility: Option<&str>, ) -> NodeId
Add a type alias node with visibility.
Sourcepub fn add_lifetime(
&mut self,
qualified_name: &str,
span: Option<Span>,
) -> NodeId
pub fn add_lifetime( &mut self, qualified_name: &str, span: Option<Span>, ) -> NodeId
Add a lifetime node.
Sourcepub fn add_lifetime_constraint_edge(
&mut self,
source: NodeId,
target: NodeId,
constraint_kind: LifetimeConstraintKind,
)
pub fn add_lifetime_constraint_edge( &mut self, source: NodeId, target: NodeId, constraint_kind: LifetimeConstraintKind, )
Add a lifetime constraint edge.
Sourcepub fn add_trait_method_binding_edge(
&mut self,
caller: NodeId,
callee: NodeId,
trait_name: &str,
impl_type: &str,
is_ambiguous: bool,
)
pub fn add_trait_method_binding_edge( &mut self, caller: NodeId, callee: NodeId, trait_name: &str, impl_type: &str, is_ambiguous: bool, )
Add a trait method binding edge.
This edge represents the resolution of a trait method call to a concrete implementation.
Sourcepub fn add_macro_expansion_edge(
&mut self,
invocation: NodeId,
expansion: NodeId,
expansion_kind: MacroExpansionKind,
is_verified: bool,
)
pub fn add_macro_expansion_edge( &mut self, invocation: NodeId, expansion: NodeId, expansion_kind: MacroExpansionKind, is_verified: bool, )
Add a macro expansion edge.
Represents the expansion of a macro invocation to its generated code. Only available when macro expansion is enabled.
§Arguments
invocation- The macro invocation site node (e.g., derive attribute or macro call)expansion- The macro definition or generated code nodeexpansion_kind- The kind of macro expansion (Derive, Attribute, Declarative, Function)is_verified- Whether the expansion has been verified (requirescargo expand)
§Example
// #[derive(Debug)] on a struct
let struct_id = helper.add_struct("MyStruct", Some(span));
let derive_macro_id = helper.add_node("MyStruct::derive_Debug", None, NodeKind::Macro);
helper.add_macro_expansion_edge(
struct_id,
derive_macro_id,
MacroExpansionKind::Derive,
false,
);Sourcepub fn add_node(
&mut self,
qualified_name: &str,
span: Option<Span>,
kind: NodeKind,
) -> NodeId
pub fn add_node( &mut self, qualified_name: &str, span: Option<Span>, kind: NodeKind, ) -> NodeId
Add a generic node with custom kind.
Sourcepub fn add_node_with_visibility(
&mut self,
qualified_name: &str,
span: Option<Span>,
kind: NodeKind,
visibility: Option<&str>,
) -> NodeId
pub fn add_node_with_visibility( &mut self, qualified_name: &str, span: Option<Span>, kind: NodeKind, visibility: Option<&str>, ) -> NodeId
Add a generic node with visibility.
Sourcepub fn add_call_edge(&mut self, caller: NodeId, callee: NodeId)
pub fn add_call_edge(&mut self, caller: NodeId, callee: NodeId)
Add a call edge from caller to callee.
Sourcepub fn add_call_edge_with_span(
&mut self,
caller: NodeId,
callee: NodeId,
spans: Vec<Span>,
)
pub fn add_call_edge_with_span( &mut self, caller: NodeId, callee: NodeId, spans: Vec<Span>, )
Add a call edge from caller to callee with source span information.
The span should point to the call site location in source code.
§Note
This method uses default metadata (argument_count: 255 sentinel for unknown, is_async: false).
Use add_call_edge_full when you need to specify
argument count or async status explicitly.
Sourcepub fn add_call_edge_full(
&mut self,
caller: NodeId,
callee: NodeId,
argument_count: u8,
is_async: bool,
)
pub fn add_call_edge_full( &mut self, caller: NodeId, callee: NodeId, argument_count: u8, is_async: bool, )
Add a call edge with full metadata.
Use this method when you know the argument count or when the call is async.
For calls where metadata is unknown, use add_call_edge
which uses default values (argument_count: 255 sentinel, is_async: false).
§Arguments
caller- The node making the callcallee- The node being calledargument_count- Number of arguments in the call (0-254, use 255 for unknown)is_async- Whether this is an async/await call
§Canonical Usage
| Scenario | Method |
|---|---|
| Argument count known, sync call | add_call_edge_full(caller, callee, arg_count, false) |
| Argument count known, async call | add_call_edge_full(caller, callee, arg_count, true) |
| Argument count unknown, sync call | add_call_edge(caller, callee) or add_call_edge_full(caller, callee, 255, false) |
§Example
// Function call with 3 arguments
helper.add_call_edge_full(main_id, helper_id, 3, false);
// Async call with 1 argument
helper.add_call_edge_full(main_id, async_fn_id, 1, true);Sourcepub fn add_call_edge_full_with_span(
&mut self,
caller: NodeId,
callee: NodeId,
argument_count: u8,
is_async: bool,
spans: Vec<Span>,
)
pub fn add_call_edge_full_with_span( &mut self, caller: NodeId, callee: NodeId, argument_count: u8, is_async: bool, spans: Vec<Span>, )
Add a call edge with full metadata and source span information.
Combines the functionality of add_call_edge_full
and span tracking.
Sourcepub fn add_table_read_edge_with_span(
&mut self,
reader: NodeId,
table: NodeId,
table_name: &str,
schema: Option<&str>,
spans: Vec<Span>,
)
pub fn add_table_read_edge_with_span( &mut self, reader: NodeId, table: NodeId, table_name: &str, schema: Option<&str>, spans: Vec<Span>, )
Add a database table read edge (SQL).
Sourcepub fn add_table_write_edge_with_span(
&mut self,
writer: NodeId,
table: NodeId,
table_name: &str,
schema: Option<&str>,
operation: TableWriteOp,
spans: Vec<Span>,
)
pub fn add_table_write_edge_with_span( &mut self, writer: NodeId, table: NodeId, table_name: &str, schema: Option<&str>, operation: TableWriteOp, spans: Vec<Span>, )
Add a database table write edge (SQL).
Sourcepub fn add_triggered_by_edge_with_span(
&mut self,
trigger: NodeId,
table: NodeId,
trigger_name: &str,
schema: Option<&str>,
spans: Vec<Span>,
)
pub fn add_triggered_by_edge_with_span( &mut self, trigger: NodeId, table: NodeId, trigger_name: &str, schema: Option<&str>, spans: Vec<Span>, )
Add a database trigger relationship edge (SQL).
Convention: trigger -> table with EdgeKind::TriggeredBy.
Sourcepub fn add_import_edge(&mut self, importer: NodeId, imported: NodeId)
pub fn add_import_edge(&mut self, importer: NodeId, imported: NodeId)
Add an import edge from importer to imported module/symbol.
This method uses default metadata (alias: None, is_wildcard: false).
Use add_import_edge_full when importing
with an alias or for wildcard imports.
Sourcepub fn add_import_edge_full(
&mut self,
importer: NodeId,
imported: NodeId,
alias: Option<&str>,
is_wildcard: bool,
)
pub fn add_import_edge_full( &mut self, importer: NodeId, imported: NodeId, alias: Option<&str>, is_wildcard: bool, )
Add an import edge with full metadata.
Use this method when the import has an alias or is a wildcard import.
For simple imports without alias or wildcard, use add_import_edge.
§Arguments
importer- The node importing (e.g., module or file)imported- The node being importedalias- Optional alias string (e.g., forimport { foo as bar }, alias is “bar”)is_wildcard- Whether this is a wildcard import (e.g.,import *)
§Canonical Usage
| Import Syntax | Method |
|---|---|
import foo | add_import_edge(importer, imported) |
import foo as bar | add_import_edge_full(importer, imported, Some("bar"), false) |
import * / import *.* | add_import_edge_full(importer, imported, None, true) |
import * as ns | add_import_edge_full(importer, imported, Some("ns"), true) |
§Example
// import { HashMap as Map } from "std::collections"
let alias_id = helper.intern("Map");
helper.add_import_edge_full(module_id, hashmap_id, Some("Map"), false);
// import * from "lodash"
helper.add_import_edge_full(module_id, lodash_id, None, true);Sourcepub fn add_export_edge(&mut self, module: NodeId, exported: NodeId)
pub fn add_export_edge(&mut self, module: NodeId, exported: NodeId)
Add an export edge from module to exported symbol.
This method uses default metadata (kind: ExportKind::Direct, alias: None).
Use add_export_edge_full for re-exports,
default exports, namespace exports, or exports with aliases.
Sourcepub fn add_export_edge_full(
&mut self,
module: NodeId,
exported: NodeId,
kind: ExportKind,
alias: Option<&str>,
)
pub fn add_export_edge_full( &mut self, module: NodeId, exported: NodeId, kind: ExportKind, alias: Option<&str>, )
Add an export edge with full metadata.
Use this method for re-exports, default exports, namespace exports,
or exports with aliases. For simple direct exports without alias,
use add_export_edge.
§Arguments
module- The module/file node that contains the exportexported- The symbol being exportedkind- The kind of export:ExportKind::Direct- Direct export (export { foo })ExportKind::Reexport- Re-export from another module (export { foo } from "mod")ExportKind::Default- Default export (export default foo)ExportKind::Namespace- Namespace export (export * as ns from "mod")
alias- Optional alias string (e.g., forexport { foo as bar }, alias is “bar”)
§Canonical Usage
| Export Syntax (JS/TS) | Method |
|---|---|
export { name } | add_export_edge(module, name) |
export default foo | add_export_edge_full(module, foo, ExportKind::Default, None) |
export { foo as bar } | add_export_edge_full(module, foo, ExportKind::Direct, Some("bar")) |
export { foo } from "mod" | add_export_edge_full(module, foo, ExportKind::Reexport, None) |
export { foo as bar } from "mod" | add_export_edge_full(module, foo, ExportKind::Reexport, Some("bar")) |
export * from "mod" | add_export_edge_full(module, mod, ExportKind::Reexport, None) |
export * as ns from "mod" | add_export_edge_full(module, mod, ExportKind::Namespace, Some("ns")) |
§Example
// export default MyComponent;
helper.add_export_edge_full(module_id, component_id, ExportKind::Default, None);
// export { helper as utilHelper };
helper.add_export_edge_full(module_id, helper_id, ExportKind::Direct, Some("utilHelper"));
// export * as utils from "./utils";
helper.add_export_edge_full(module_id, utils_id, ExportKind::Namespace, Some("utils"));Sourcepub fn add_reference_edge(&mut self, from: NodeId, to: NodeId)
pub fn add_reference_edge(&mut self, from: NodeId, to: NodeId)
Add a reference edge (variable/field access).
Sourcepub fn add_defines_edge(&mut self, parent: NodeId, child: NodeId)
pub fn add_defines_edge(&mut self, parent: NodeId, child: NodeId)
Add a defines edge (module defines symbol).
Sourcepub fn add_typeof_edge(&mut self, source: NodeId, target: NodeId)
pub fn add_typeof_edge(&mut self, source: NodeId, target: NodeId)
Add a type-of edge (symbol has type).
Add a TypeOf edge without context metadata (backward compatibility).
For new code, prefer add_typeof_edge_with_context to provide semantic context.
Sourcepub fn add_typeof_edge_with_context(
&mut self,
source: NodeId,
target: NodeId,
context: Option<TypeOfContext>,
index: Option<u16>,
name: Option<&str>,
)
pub fn add_typeof_edge_with_context( &mut self, source: NodeId, target: NodeId, context: Option<TypeOfContext>, index: Option<u16>, name: Option<&str>, )
Add a TypeOf edge with optional context metadata.
§Parameters
source: The node that has this type (e.g., variable, function, parameter)target: The type nodecontext: Where this type reference appears (Parameter, Return, Field, Variable, etc.)index: Position/index (for parameters, returns, fields)name: Name (for parameters, returns, fields, variables)
§Examples
// Function parameter: func foo(ctx context.Context)
helper.add_typeof_edge_with_context(
func_id,
type_id,
Some(TypeOfContext::Parameter),
Some(0),
Some("ctx"),
);
// Function return: func bar() error
helper.add_typeof_edge_with_context(
func_id,
error_type_id,
Some(TypeOfContext::Return),
Some(0),
None,
);
// Variable: var x int
helper.add_typeof_edge_with_context(
var_id,
int_type_id,
Some(TypeOfContext::Variable),
None,
Some("x"),
);Sourcepub fn add_implements_edge(&mut self, implementor: NodeId, interface: NodeId)
pub fn add_implements_edge(&mut self, implementor: NodeId, interface: NodeId)
Add an implements edge (class implements interface).
Sourcepub fn add_inherits_edge(&mut self, child: NodeId, parent: NodeId)
pub fn add_inherits_edge(&mut self, child: NodeId, parent: NodeId)
Add an inherits edge (class extends class).
Sourcepub fn add_contains_edge(&mut self, parent: NodeId, child: NodeId)
pub fn add_contains_edge(&mut self, parent: NodeId, child: NodeId)
Add a contains edge (parent contains child, e.g., class contains method).
Sourcepub fn add_webassembly_edge(&mut self, caller: NodeId, wasm_target: NodeId)
pub fn add_webassembly_edge(&mut self, caller: NodeId, wasm_target: NodeId)
Add a WebAssembly call edge.
Used when JavaScript/TypeScript code instantiates or calls WebAssembly modules:
WebAssembly.instantiate()/WebAssembly.instantiateStreaming()new WebAssembly.Module()/new WebAssembly.Instance()- Calling exported WASM functions
Sourcepub fn add_ffi_edge(
&mut self,
caller: NodeId,
ffi_target: NodeId,
convention: FfiConvention,
)
pub fn add_ffi_edge( &mut self, caller: NodeId, ffi_target: NodeId, convention: FfiConvention, )
Add an FFI call edge with the specified calling convention.
Used for foreign function interface calls:
- Node.js native addons (
.nodefiles) - ctypes/cffi in Python
- JNI in Java
- P/Invoke in C#
Sourcepub fn add_http_request_edge(
&mut self,
caller: NodeId,
target: NodeId,
method: HttpMethod,
url: Option<&str>,
)
pub fn add_http_request_edge( &mut self, caller: NodeId, target: NodeId, method: HttpMethod, url: Option<&str>, )
Add an HTTP request edge.
Use this when detecting HTTP calls like fetch() or axios.get().
Sourcepub fn ensure_function(
&mut self,
qualified_name: &str,
span: Option<Span>,
is_async: bool,
is_unsafe: bool,
) -> NodeId
pub fn ensure_function( &mut self, qualified_name: &str, span: Option<Span>, is_async: bool, is_unsafe: bool, ) -> NodeId
Ensure a function node exists, creating it if needed.
Cross-kind reuse: if a Method node with the same canonical qualified name
already exists (e.g., created during Stage 1 declaration extraction), the
existing Method node is returned as-is. This prevents duplicate spanless
Function nodes from being created during Stage 2 call-edge construction,
which would cause get_references to silently drop callers due to
location-based deduplication at (file, line=0, col=0).
The Stage 1 declaration node is authoritative for metadata — no attributes are mutated on cross-kind reuse.
Sourcepub fn ensure_method(
&mut self,
qualified_name: &str,
span: Option<Span>,
is_async: bool,
is_static: bool,
) -> NodeId
pub fn ensure_method( &mut self, qualified_name: &str, span: Option<Span>, is_async: bool, is_static: bool, ) -> NodeId
Ensure a method node exists, creating it if needed.
Cross-kind reuse: if a Function node with the same canonical qualified name
already exists, the existing Function node is returned as-is. See
ensure_function for the rationale.
Sourcepub fn stats(&self) -> HelperStats
pub fn stats(&self) -> HelperStats
Get statistics about what’s been staged.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for GraphBuildHelper<'a>
impl<'a> RefUnwindSafe for GraphBuildHelper<'a>
impl<'a> Send for GraphBuildHelper<'a>
impl<'a> Sync for GraphBuildHelper<'a>
impl<'a> Unpin for GraphBuildHelper<'a>
impl<'a> UnsafeUnpin for GraphBuildHelper<'a>
impl<'a> !UnwindSafe for GraphBuildHelper<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more