pub struct Toolchain { /* private fields */ }
Expand description

Representation of a Rust compiler toolchain.

The Toolchain struct represents a compiler toolchain, either downloaded from rustup or from the rust-lang/rust repo’s CI artifacts storage, and it provides the methods to install and use it.

Implementations

Returns whether or not this toolchain is needed by rustwide itself.

This toolchain is used for doing things like installing tools.

let tc = Toolchain::dist("stable-x86_64-unknown-linux-gnu");
assert!(tc.is_needed_by_rustwide());
let tc = Toolchain::dist("nightly-x86_64-unknown-linux-gnu");
assert!(!tc.is_needed_by_rustwide());

Create a new dist toolchain.

Dist toolchains are all the toolchains available through rustup and distributed from static.rust-lang.org. You need to provide the toolchain name (the same you’d use to install that toolchain with rustup).

Available on crate feature unstable-toolchain-ci only.

Create a new CI toolchain.

CI toolchains are artifacts built for every merged PR in the rust-lang/rust repository, identified by the SHA of the merge commit. These builds are purged after a couple of months, and are available both in normal mode and “alternate” mode (experimental builds with extra debugging and testing features enabled).

There is no availability or stability guarantee for these builds!

If this toolchain is a dist toolchain, return its metadata.

Available on crate feature unstable-toolchain-ci only.

If this toolchain is a CI toolchain, return its metadata.

Download and install the toolchain.

Download and install a component for the toolchain.

Remove a component already installed for the toolchain.

Download and install a target for the toolchain.

If the toolchain is not installed in the workspace an error will be returned. This is only supported for dist toolchains.

Remove a target already installed for the toolchain.

If the toolchain is not installed in the workspace or the target is missing an error will be returned. This is only supported for dist toolchains.

Return a list of installed targets for this toolchain.

If the toolchain is not installed an empty list is returned.

Remove the toolchain from the rustwide workspace, freeing up disk space.

Return a runnable object configured to run cargo with this toolchain. This method is intended to be used with rustwide::cmd::Command.

Example
let toolchain = Toolchain::dist("beta");
Command::new(&workspace, toolchain.cargo())
    .args(&["check"])
    .run()?;

Return a runnable object configured to run rustc with this toolchain. This method is intended to be used with rustwide::cmd::Command.

Example
let toolchain = Toolchain::dist("beta");
Command::new(&workspace, toolchain.rustc())
    .args(&["hello.rs"])
    .run()?;

Return a runnable object configured to run name with this toolchain. This method is intended to be used with rustwide::cmd::Command.

Example
let toolchain = Toolchain::dist("beta");
Command::new(&workspace, toolchain.rustup_binary("rustdoc"))
    .args(&["hello.rs"])
    .run()?;

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.