Struct rustdoc_json::Builder
source · pub struct Builder { /* private fields */ }
Expand description
Builds rustdoc JSON. There are many build options. Refer to the docs to learn about them all. See top-level docs for an example on how to use this builder.
Implementations§
source§impl Builder
impl Builder
sourcepub fn toolchain(self, toolchain: impl Into<String>) -> Self
pub fn toolchain(self, toolchain: impl Into<String>) -> Self
Set the toolchain. Default: None
.
Until rustdoc JSON has stabilized, you will want to set this to
be "nightly"
or similar.
If the toolchain is set as None
, the current active toolchain will be used.
§Notes
The currently active toolchain is typically specified by the
RUSTUP_TOOLCHAIN
environment variable, which the rustup proxy
mechanism sets. See https://rust-lang.github.io/rustup/overrides.html
for more info on how the active toolchain is determined.
sourcepub fn clear_toolchain(self) -> Self
pub fn clear_toolchain(self) -> Self
Clear a toolchain previously set with Self::toolchain
.
sourcepub fn manifest_path(self, manifest_path: impl AsRef<Path>) -> Self
pub fn manifest_path(self, manifest_path: impl AsRef<Path>) -> Self
Set the relative or absolute path to Cargo.toml
. Default: Cargo.toml
sourcepub fn target_dir(self, target_dir: impl AsRef<Path>) -> Self
pub fn target_dir(self, target_dir: impl AsRef<Path>) -> Self
Set what --target-dir
to pass to cargo
. Typically only needed if you
want to be able to build rustdoc JSON for the same crate concurrently,
for example to parallelize regression tests.
sourcepub fn clear_target_dir(self) -> Self
pub fn clear_target_dir(self) -> Self
Clear a target dir previously set with Self::target_dir
.
sourcepub const fn quiet(self, quiet: bool) -> Self
pub const fn quiet(self, quiet: bool) -> Self
Whether or not to pass --quiet
to cargo rustdoc
. Default: false
sourcepub const fn silent(self, silent: bool) -> Self
pub const fn silent(self, silent: bool) -> Self
Whether or not to redirect stdout and stderr to /dev/null. Default: false
sourcepub const fn verbose(self, verbose: bool) -> Self
pub const fn verbose(self, verbose: bool) -> Self
Whether or not to print verbose output for debugging purposes on stderr.
The format of the output can change in patch releases. Do not rely on it
in any way. Default: false
sourcepub fn target(self, target: String) -> Self
pub fn target(self, target: String) -> Self
Whether or not to pass --target
to cargo rustdoc
. Default: None
sourcepub const fn no_default_features(self, no_default_features: bool) -> Self
pub const fn no_default_features(self, no_default_features: bool) -> Self
Whether to pass --no-default-features
to cargo rustdoc
. Default: false
sourcepub const fn all_features(self, all_features: bool) -> Self
pub const fn all_features(self, all_features: bool) -> Self
Whether to pass --all-features
to cargo rustdoc
. Default: false
sourcepub fn features<I: IntoIterator<Item = S>, S: AsRef<str>>(
self,
features: I
) -> Self
pub fn features<I: IntoIterator<Item = S>, S: AsRef<str>>( self, features: I ) -> Self
Features to pass to cargo rustdoc
via --features
. Default to an empty vector
sourcepub fn package(self, package: impl AsRef<str>) -> Self
pub fn package(self, package: impl AsRef<str>) -> Self
Package to use for cargo rustdoc
via -p
. Default: None
sourcepub fn package_target(self, package_target: PackageTarget) -> Self
pub fn package_target(self, package_target: PackageTarget) -> Self
What part of the package to document. Default: PackageTarget::Lib
sourcepub fn document_private_items(self, document_private_items: bool) -> Self
pub fn document_private_items(self, document_private_items: bool) -> Self
Whether to pass --document-private-items
to cargo rustdoc
. Default: false
sourcepub fn cap_lints(self, cap_lints: Option<impl AsRef<str>>) -> Self
pub fn cap_lints(self, cap_lints: Option<impl AsRef<str>>) -> Self
What to pass as --cap-lints
to rustdoc JSON build command
sourcepub fn build(self) -> Result<PathBuf, BuildError>
pub fn build(self) -> Result<PathBuf, BuildError>
Generate rustdoc JSON for a library crate. Returns the path to the freshly built rustdoc JSON file.
See top-level docs for an example on how to use it.
§Errors
E.g. if building the JSON fails or if the manifest path does not exist or is invalid.