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

A builder interface for constructing the Sysroot

See the individual methods for more details on what this means and what defaults exist.

Implementations

New SysrootBuilder.

sysroot_crate specifies which libraries to build as part of the sysroot. See Sysroot for more details.

Set path to the Cargo.toml of the project requiring a custom sysroot.

If provided, any Cargo Profile’s in the provided manifest will be copied into the sysroot crate being compiled.

If not provided, profiles use their default settings.

By default this will be None.

Set where the sysroot directory will be placed.

By default this is ./target/sysroot.

The target to compile for. This can be a target-triple, or a JSON Target Specification.

By default this is None, and if not set when SysrootBuilder::build is called, will cause an error.

The rust source directory. These are used to compile the sysroot.

By default this uses the rust-src component from the current rustup toolchain.

Which features to enable.

This adds to, not replaces, any previous calls to this method.

By default this is empty.

See Features for details.

Custom flags to pass to all rustc compiler invocations.

This adds to, not replaces, any previous calls to this method.

By default this is empty.

Internal

This will use the RUSTFLAGS to ensure flags are set for all invocations.

Flags passed to this method will be appended to any existing RUSTFLAGS.

Build the Sysroot, and return a path suitable to pass to rustc.

Errors
  • SysrootBuilder::target was not called
  • If manifest is provided and does not exist
  • If target is a JSON specification, but doesn’t exist.
  • If the rust_src directory does not exist, or could not be detected.
  • If the sysroot cannot be setup, or fails to compile

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

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

Performs the conversion.

Performs the conversion.

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

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.