cargo wrapper for this library
You probably want the
cargo wrapper to this library. See https://github.com/Enselic/cargo-public-items.
List public items (the public API) of a Rust library crate by analyzing the rustdoc JSON of the crate.
Again, you probably want to use the convenient
cargo public-items wrapper. But if you don't want to use the
cargo wrapper, you do as follows:
# Install the tool that comes with this package
cargo install public_items
# Generate rustdoc JSON for your Rust library
RUSTDOCFLAGS='-Z unstable-options --output-format json' cargo +nightly doc --lib --no-deps
# List all items in the public API of the Rust library using the tool
Using the tool on its own library:
% RUSTDOCFLAGS='-Z unstable-options --output-format json' cargo +nightly doc --lib --no-deps
% public_items ./target/doc/public_items.json
Tip: By writing the public API to a file for two different versions of your library, you can diff your public API across versions.
Maintainers of Rust libraries that want to keep track of changes to their public API.
- The type of items are not shown. So a struct field and and struct method is listed as
Struct::method. And tuple structs will just be represented with
Struct::1, etc. Since Rust does not support method overloading, this is not that big of an issue in practice.