rustdoc.py¶
clew/rustdoc.py
rustdoc JSON ingestion — the Rust analog of `doxygen.py`'s `run_doxygen`.
has_cargo_manifest
bool clew.rustdoc.has_cargo_manifest(Path repo_root)
True when repo_root is a cargo package or workspace.
Called by test_has_cargo_manifest_false_without_one, test_has_cargo_manifest_true_for_a_cargo_repo, uses_rustdoc
Calls none
Source · 5 lines
def has_cargo_manifest(repo_root: Path) -> bool:
"""@brief Cheap, no-subprocess check for "is this a Rust repo"."""
return (Path(repo_root) / "Cargo.toml").is_file()
Activity · 1 steps
Flows
uses_rustdoc
bool clew.rustdoc.uses_rustdoc(Path repo_root)
Whether repo_root 's build routes through rustdoc instead of doxygen.
Called by _check_doxygen, _is_rust_only_repo
Source · 20 lines
def uses_rustdoc(repo_root: Path) -> bool:
"""Doxygen has no Rust parser, so a cargo repo's structural index comes from
this module instead — UNLESS the repo already ships its own Doxyfile, which
means an owner deliberately configured a doxygen build (a C/C++ project
that happens to vendor a small Rust tool, say) and that configuration
should win rather than being silently overridden by Cargo.toml's mere
presence. Shared by `cli.py`'s build-routing decision and `init_command.py`'s
doxygen doctor check — both need the same answer to "will this repo ever
invoke doxygen at all", so it lives once, here, rather than being
reimplemented per caller.
@brief Decide whether this repo's build uses rustdoc instead of doxygen.
@return True when `repo_root` has a Cargo.toml and no discoverable Doxyfile.
@version 1
"""
from .doxygen import discover_doxyfile
return has_cargo_manifest(repo_root) and discover_doxyfile(repo_root) is None