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