Skip to main content

Module source

Module source 

Source
Expand description

Pure Rust-source lexer shared by search, callgraph, and indexing tools. 供搜索、调用图与索引工具共用的纯 Rust 源码词法器。

Every function here is a text transformation only: callers own file I/O. 这里的所有函数只做文本变换,文件 I/O 由调用方负责。

Function discovery lives here; calls scans call sites inside an extracted body and walk owns the recursive source traversal. 函数发现位于本页;calls 扫描已提取函数体内的调用点,walk 拥有递归源码遍历。

Structs§

SourceFunction
One Rust function discovered in a source file. 在源码文件中发现的一个 Rust 函数。
SourceWalk
Which subtrees a source walk never enters. 源码遍历永不进入的子树。

Enums§

Keep
What a walk should do with one .rs file it found. 遍历发现一个 .rs 文件后应当做什么。

Constants§

MAX_DEPTH
How deep the walk nests before it assumes the tree is cyclic. 遍历在假定树存在环之前允许达到的深度。

Traits§

SourceTree
The filesystem facts a recursive source walk needs. 递归源码遍历所需的文件系统事实。

Functions§

body_calls
Match a real function call in a body, ignoring comments, strings and macros. 只匹配函数体里的真实调用,跳过注释、字符串和宏调用。
collect_rust_sources
Every .rs file under root, depth-first, in directory order. root 下每个 .rs 文件,深度优先,按目录顺序。
direct_calls
List the distinct direct callees of one function body, in sorted order. 列出函数体内的直接调用目标(去重并排序)。
function_source_range
Find the 0-based inclusive line range of a function by name. 按名称查找函数的 0 起始闭区间行范围。
function_symbols
Index function bodies without treating comments, strings, or macro text as Rust. 扫描函数体时屏蔽注释、字符串和宏文本,避免把它们误认成 Rust 函数。
mask_literals
Replace quoted literals with spaces while preserving offsets, keeping comments. 用空格替换引号字面量,同时保留原始偏移量,并保留注释。
mask_non_code
Replace comments and quoted literals with spaces while preserving offsets. 用空格替换注释和引号字面量,同时保留原始偏移量。 Blank the contents of comments, string literals and character literals. 把注释、字符串字面量与字符字面量的内容抹成空白。
registration_kinds
Collect the deduplicated kind: values used in registration declarations. 收集注册声明中出现过的 kind: 取值,去重并排序。