Extract all public unsafe APIs (unsafe functions and unsafe traits) from the Bevy game engine workspace, and save the results to a static HTML table.
Extract and audit all public unsafe APIs (unsafe fn and unsafe trait) from the Bevy game engine workspace.
👉 Live Documentation (Auto-updated Daily)
The script scans a local clone of the Bevy repository via rustdoc JSON, collects every item that is both pub and unsafe, and writes a five-column HTML table:
| Column | Content |
|---|---|
| (drag handle) | grab handle for reordering rows |
| Module | module path, e.g. bevy_ptr |
| API | full item path linked to docs.rs |
| Safety doc | text from the # Safety section of the item's docs |
| Confirmed ✓ | checkbox to mark an API as reviewed |
- Rust nightly toolchain:
rustup toolchain install nightly
- A local clone of Bevy (a shallow clone is recommended for speed):
git clone --depth 1 https://github.com/bevyengine/bevy.git bevy_src
- Python 3 (3.8 or newer, no extra packages required).
Run the script from your repository root, explicitly providing the path to the Bevy source and your desired output file:
python3 scripts/extract_bevy.py --bevy-dir ./bevy_src --output ./docs/index.htmlThis will:
- Pass the
RUSTDOCFLAGSenvironment variable to enable JSON output. - Run
cargo +nightly doc --workspace --no-depsinside the provided Bevy directory. - Parse each generated JSON file (filtering for crates prefixed with
bevy) and collect public unsafe items. - Write the interactive HTML table to the specified
--outputpath. - Print the number of items parsed per crate.
This project uses a modern artifact-based deployment pipeline. The site is not served from a committed docs/ folder on the main branch.
Instead, the Generate and Deploy Bevy Unsafe Docs workflow runs automatically every day at midnight UTC (or manually via workflow dispatch). It performs the following on a cloud runner:
- Performs a shallow clone of the latest Bevy
mainbranch. - Compiles the rustdoc JSON.
- Generates the HTML artifact.
- Deploys it directly to GitHub Pages' CDN nodes, keeping your Git commit history completely clean.
Since the CI workflow uses Artifacts, you must configure your repository settings accordingly:
- Go to Settings → Pages in your repository.
- Under Build and deployment → Source, change the dropdown from "Deploy from a branch" to GitHub Actions.
Once the workflow completes its first run, your site will be live at your standard GitHub Pages URL.
- Nightly required: rustdoc JSON (
-Z unstable-options --output-format json) is a nightly-only unstable feature. - AST Parsing Limits: This tool currently relies on Python dictionaries to parse the compiler's JSON output. It effectively captures standard
pub unsafe fnandpub unsafe traitdefinitions but may miss complex macro-generated unsafe implementations (like those produced by#[derive(Component)]). - Build Time: The first run is significantly slower (can take several minutes) because
cargomust analyze and document the entire Bevy workspace. Subsequent runs on the same source directory will reuse the build cache.