Skip to main content

extract_includes

Function extract_includes 

Source
pub fn extract_includes(source: &str) -> Vec<String>
Expand description

Extract the file paths of all INCLUDE directives from an ink source.

Performs a full parse and walks the resulting AST for IncludeStmt nodes, returning each include’s raw filename (whitespace-trimmed). Includes nested in commented-out blocks are correctly excluded by the parser.

Useful for tools that need to discover an ink project’s transitive file graph without doing full HIR lowering — for example, the bevy .ink asset loader walks the include graph asynchronously and feeds the resulting source cache into the synchronous compiler.