Document a single crate that lives inside a Cargo workspace.
Your repository has a Cargo.toml at the root with a [workspace]
section, and the actual crates live under crates/, packages/, or
similar subdirectories.
cargo buildsucceeds in the workspace rootrustdoc-llmsandrustdoc-mdinstalled
rustdoc-llms reads the Cargo.toml in the current working
directory. For a workspace, run it from the directory of the crate you
want to document.
-
Change into the member crate's directory:
cd crates/<member-name>
-
Run the tool:
rustdoc-llms
-
Outputs land under the workspace's shared
target/doc/:ls ../../target/doc/<member_name>.json ls ../../target/doc/llms.txt
(Cargo workspaces share one
target/at the workspace root.) -
Repeat for each member crate you want to document.
For each member:
test -f ../../target/doc/<member_name>.json && echo "JSON ok for <member-name>"-
One run produces one crate's docs. There is no
--workspacemode; loop over crates explicitly. -
The shared
target/doc/llms.txtis overwritten on every run. After running for crate A, then crate B, only crate B'sllms.txtremains. Copy each crate's output before running the next:cd crates/foo && rustdoc-llms && cp ../../target/doc/llms.txt foo-llms.txt cd ../bar && rustdoc-llms && cp ../../target/doc/llms.txt bar-llms.txt
-
The JSON files are per-crate (
<crate_name>.json) so they do not collide. -
If you want a single combined
llms.txtfor the entire workspace, concatenating the per-crate outputs is currently the simplest path.