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

source

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.

source

pub fn clear_toolchain(self) -> Self

Clear a toolchain previously set with Self::toolchain.

source

pub fn manifest_path(self, manifest_path: impl AsRef<Path>) -> Self

Set the relative or absolute path to Cargo.toml. Default: Cargo.toml

source

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.

source

pub fn clear_target_dir(self) -> Self

Clear a target dir previously set with Self::target_dir.

source

pub const fn quiet(self, quiet: bool) -> Self

Whether or not to pass --quiet to cargo rustdoc. Default: false

source

pub const fn silent(self, silent: bool) -> Self

Whether or not to redirect stdout and stderr to /dev/null. Default: false

source

pub fn target(self, target: String) -> Self

Whether or not to pass --target to cargo rustdoc. Default: None

source

pub const fn no_default_features(self, no_default_features: bool) -> Self

Whether to pass --no-default-features to cargo rustdoc. Default: false

source

pub const fn all_features(self, all_features: bool) -> Self

Whether to pass --all-features to cargo rustdoc. Default: false

source

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

source

pub fn package(self, package: impl AsRef<str>) -> Self

Package to use for cargo rustdoc via -p. Default: None

source

pub fn package_target(self, package_target: PackageTarget) -> Self

What part of the package to document. Default: PackageTarget::Lib

source

pub fn document_private_items(self, document_private_items: bool) -> Self

Whether to pass --document-private-items to cargo rustdoc. Default: false

source

pub fn cap_lints(self, cap_lints: Option<impl AsRef<str>>) -> Self

What to pass as --cap-lints to rustdoc JSON build command

source

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.

Trait Implementations§

source§

impl Clone for Builder

source§

fn clone(&self) -> Builder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Builder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Builder

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more