MCPcopy Create free account
hub / github.com/Open-Quant/openquant / scan_rust

Function scan_rust

scripts/generate_api_inventory.py:19–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17# recursively, so nested modules (e.g. openquant/src/util/*.rs) are included.
18RUST_CRATES = ("openquant", "pyopenquant")
19PY_SRC = ROOT / "python" / "openquant"
20OUT = ROOT / "docs-site" / "src" / "data" / "apiInventory.ts"
21
22RUST_FN_RE = re.compile(r"^pub\s+fn\s+([a-zA-Z0-9_]+)\s*\(")
23# Top-level public items (column 0) and the rustdoc page kind each one gets.
24RUST_ITEM_RE = re.compile(
25 r"^pub\s+(?:async\s+)?(fn|struct|enum|trait|type|const|static)\s+([A-Za-z0-9_]+)"
26)
27RUSTDOC_KIND = {"const": "constant"}
28# `impl Foo`, `impl<T> Foo<T>`; not `impl Trait for Foo` (those methods are not `pub fn`).
29RUST_IMPL_RE = re.compile(r"^impl(?:<[^>]*>)?\s+([A-Za-z0-9_]+)(?:<[^>]*>)?\s*\{?\s*$")
30RUST_METHOD_RE = re.compile(r"^\s+pub\s+(?:const\s+)?(?:async\s+)?fn\s+([a-zA-Z0-9_]+)")
31PY_FN_RE = re.compile(r"^def\s+([a-zA-Z0-9_]+)\s*\(")
32
33
34def rust_module_key(crate: str, src_root: Path, path: Path) -> str:
35 """Rust-style module path, e.g. ``openquant::util::volatility``.
36

Callers 1

mainFunction · 0.85

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected