[][src]Struct cargo_sysroot::SysrootBuilder

pub struct SysrootBuilder { /* fields omitted */ }

A builder interface for constructing the Sysroot

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

Implementations

impl SysrootBuilder[src]

pub fn new(sysroot_crate: Sysroot) -> Self[src]

New SysrootBuilder.

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

pub fn manifest(&mut self, manifest: PathBuf) -> &mut Self[src]

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.

pub fn output(&mut self, output: PathBuf) -> &mut Self[src]

Set where the sysroot directory will be placed.

By default this is ./target/sysroot.

pub fn target(&mut self, target: PathBuf) -> &mut Self[src]

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.

pub fn rust_src(&mut self, rust_src: PathBuf) -> &mut Self[src]

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

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

pub fn features(&mut self, features: &[Features]) -> &mut Self[src]

Which features to enable.

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

By default this is empty.

See Features for details.

pub fn rustc_flags<I, S>(&mut self, flags: I) -> &mut Self where
    I: IntoIterator<Item = S>,
    S: Into<OsString>, 
[src]

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.

pub fn build(&self) -> Result<PathBuf>[src]

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

impl Clone for SysrootBuilder[src]

impl Debug for SysrootBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.