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# Every crate whose `src/` tree is part of the public API surface. Scanned
18# recursively, so nested modules (e.g. openquant/src/util/*.rs) are included.
19RUST_CRATES = ("openquant", "pyopenquant")
20PY_SRC = ROOT / "python" / "openquant"
21OUT = ROOT / "docs-site" / "src" / "data" / "apiInventory.ts"
22
23RUST_FN_RE = re.compile(r"^pub\s+fn\s+([a-zA-Z0-9_]+)\s*\(")
24# Top-level public items (column 0) and the rustdoc page kind each one gets.
25RUST_ITEM_RE = re.compile(
26 r"^pub\s+(?:async\s+)?(fn|struct|enum|trait|type|const|static)\s+([A-Za-z0-9_]+)"
27)
28RUSTDOC_KIND = {"const": "constant"}
29# `impl Foo`, `impl<T> Foo<T>`; not `impl Trait for Foo` (those methods are not `pub fn`).
30RUST_IMPL_RE = re.compile(r"^impl(?:<[^>]*>)?\s+([A-Za-z0-9_]+)(?:<[^>]*>)?\s*\{?\s*$")
31RUST_METHOD_RE = re.compile(r"^\s+pub\s+(?:const\s+)?(?:async\s+)?fn\s+([a-zA-Z0-9_]+)")
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