Function public_api::public_api_from_rustdoc_json_str
source · [−]pub fn public_api_from_rustdoc_json_str(
rustdoc_json_str: &str,
options: Options
) -> Result<Vec<PublicItem>>
Expand description
Takes rustdoc JSON and returns a Vec
of PublicItem
s where each
PublicItem
is one public item of the crate, i.e. part of the crate’s
public API.
There exists a convenient cargo public-api
subcommand wrapper for this
function found at https://github.com/Enselic/cargo-public-api that
builds the rustdoc JSON for you and then invokes this function. If you don’t
want to use that wrapper, use
RUSTDOCFLAGS='-Z unstable-options --output-format json' cargo +nightly doc --lib --no-deps
to generate the rustdoc JSON that this function takes as input. The output
is put in ./target/doc/your_library.json
.
For reference, the rustdoc JSON format is documented at https://rust-lang.github.io/rfcs/2963-rustdoc-json.html. But the format is still a moving target. Open PRs and issues for rustdoc JSON itself can be found at https://github.com/rust-lang/rust/labels/A-rustdoc-json.
Errors
E.g. if the JSON is invalid.