run_rustdoc

Function run_rustdoc 

Source
pub fn run_rustdoc(
    crate_dir: &Path,
    crate_name: &str,
    features: Option<&str>,
    no_default_features: bool,
    target: Option<&str>,
    allow_rustup: bool,
) -> Result<Crate>
Expand description

Runs rustdoc for a given crate and parses the resulting JSON output.

This function uses the rustdoc-json crate to invoke rustdoc with the necessary flags to produce JSON output. It requires a specific nightly Rust toolchain (see NIGHTLY_RUST_VERSION).

§Arguments

  • crate_dir: Path to the root directory of the crate.
  • crate_name: The name of the crate (as it appears in Cargo.toml).
  • features: An optional space-separated string of features to enable.
  • no_default_features: If true, the default feature will not be activated.
  • target: An optional target triple to build documentation for.
  • allow_rustup: If true, the function will attempt to install the required nightly toolchain using rustup. If false and the toolchain is not present, it may fail.

§Returns

A Result containing the parsed rustdoc_types::Crate data, or an error if rustdoc execution or JSON parsing fails.