Generate Rust API docs and definitions to be used as context for coding AIs.
Tired of programming with AIs that simply don't know what types and methods are available in your Rust project? Or perhaps how the APIs of the popular crates you use have changed in more recent versions? Not to mention the more obscure crates which AIs are not trained on...
ai-rustdoc takes the JSON output of rustdoc:
cargo +nightly rustdoc --manifest-path <my_crate>/Cargo.toml -- -Z unstable-options --output-format jsonand generates neatly organized markdown files containing all APIs in the crate:
pub fn encode(bytes: &[u8]) -> String;Convert a byte slice to an owned hex string. If you simply need to display a
byte slice as hex, use display instead, which avoids the allocation.
pub fn display(bytes: &[u8]) -> HexDisplay<'_>;Get a HexDisplay which provides a Debug and Display impl for the
given byte slice. Useful for displaying a hex value without allocating.
Example:
let bytes = [69u8; 32];
println!("Bytes as hex: {}", hex::display(&bytes));
Provides Debug and Display impls for a byte slice.
Useful for displaying hex value without allocating via encode.
This project has no affiliation with the Rust project or the rustdoc tool.
ai-rustdoc is a work in progress.
- Parse
rustdocJSON outputs - Print API info in a clean and informative manner suitable for use by AIs
- Expose
rustdocJSON -> markdown conversion as a CLI tool - Distribute as a cargo custom command
cargo ai-rustdoc [<crate_name>]to generate AI docs for a specific crate, all crates in the workspace, or all crates and all dependencies in the workspace. Rename tocargo-ai-rustdoc?
MIT