use std::{ffi::OsString, path::PathBuf};
mod build;
#[derive(thiserror::Error, Debug)]
pub enum BuildError {
#[error("Manifest must be for an actual package. `{0:?}` is a virtual manifest")]
VirtualManifest(PathBuf),
#[error("Failed to build rustdoc JSON. Stderr: {0}")]
General(String),
#[error(transparent)]
CargoTomlError(#[from] cargo_toml::Error),
#[error(transparent)]
CargoMetadataError(#[from] cargo_metadata::Error),
#[error(transparent)]
IoError(#[from] std::io::Error),
}
#[derive(Debug)]
pub struct BuildOptions {
toolchain: Option<OsString>,
manifest_path: std::path::PathBuf,
quiet: bool,
}
pub fn build(options: BuildOptions) -> Result<PathBuf, BuildError> {
build::run_cargo_rustdoc(options)
}