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

A builder-pattern which constructs a command to invoke cargo build

Implementations§

source§

impl CargoBuilder

source

pub fn new(env: &Environment, working_dir: &Path, clean_env: bool) -> Self

Construct a new builder instance to run cargo in the given directory.

If clean_env is set, cargo configuration variables will not be passed through from the command.

source

pub fn construct(&mut self) -> Command

Constructs the command which will execute cargo

source

pub fn cargo_path(&mut self, cargo: &Path) -> &mut Self

Set the path to the cargo executable

source

pub fn home(&mut self, home: &Path) -> &mut Self

Set the CARGO_HOME variable for invoking cargo

source

pub fn target_dir(&mut self, target_dir: &Path) -> &mut Self

Set the CARGO_TARGET_DIR variable for invoking cargo

source

pub fn rustc(&mut self, rustc: &Path) -> &mut Self

Set the RUSTC variable for invoking cargo

source

pub fn rustc_wrapper(&mut self, rustc_wrapper: &Path) -> &mut Self

Set the RUSTC_WRAPPER variable for invoking cargo

source

pub fn rustdoc(&mut self, rustdoc: &Path) -> &mut Self

Set the RUSTDOC variable when invoking cargo

source

pub fn add_rustdoc_flag(&mut self, rustdoc_flag: &str) -> &mut Self

Add an item to the RUSTDOCFLAGS environment string

source

pub fn add_rustdoc_flags(&mut self, rustdoc_flags: &[&str]) -> &mut Self

Add multiple items to the RUSTDOCFLAGS environment string

source

pub fn add_rust_flag(&mut self, rust_flag: &str) -> &mut Self

Add an item to the RUSTFLAGS environment string

source

pub fn add_rust_flags(&mut self, rust_flags: &[&str]) -> &mut Self

Add multiple items to the RUSTFLAGS environment string

source

pub fn incremental(&mut self, incremental: bool) -> &mut Self

Explicitly set whether incremental builds are enabled or disabled

source

pub fn cache_rustc_info(&mut self, cache_rustc_info: bool) -> &mut Self

Enable/disable whether or not cargo should cache rust info

source

pub fn term(&mut self, term: &str) -> &mut Self

Set the terminal environment variable.

source

pub fn build_jobs(&mut self, build_jobs: u64) -> &mut Self

Override the build.jobs configuration option

source

pub fn target(&mut self, target: &str) -> &mut Self

Override the build.target configuration option

source

pub fn dep_info_basedir(&mut self, dep_info_basedir: &Path) -> &mut Self

Override the build.dep-info-basedir configuration option

source

pub fn pipelining(&mut self, pipelining: bool) -> &mut Self

Override the build.pipelining configuration option

source

pub fn http_debug(&mut self, http_debug: bool) -> &mut Self

Override the http.debug configuration option

source

pub fn http_proxy(&mut self, http_proxy: &str) -> &mut Self

Override the http.proxy configuration option

source

pub fn http_timeout(&mut self, http_timeout: Duration) -> &mut Self

Override the http.debug configuration option

source

pub fn http_cainfo(&mut self, http_cainfo: &Path) -> &mut Self

Override the http.cainfo file configuration option

source

pub fn http_check_revoke(&mut self, http_check_revoke: bool) -> &mut Self

Override the http.check-revoke configuration option

source

pub fn http_ssl_version(&mut self, http_ssl_version: &str) -> &mut Self

Override the http.ssl-version configuration option

source

pub fn http_low_speed_limit(&mut self, http_low_speed_limit: u64) -> &mut Self

Override the http.low-speed-limit configuration option

source

pub fn http_multiplexing(&mut self, http_multiplexing: bool) -> &mut Self

Override the http.multiplexing configuration option

source

pub fn http_user_agent(&mut self, http_user_agent: String) -> &mut Self

Override the http.user-agent configuration option

source

pub fn net_retry(&mut self, net_retry: u64) -> &mut Self

Override the net.retry configuration option

source

pub fn net_git_fetch_with_cli( &mut self, net_git_fetch_with_cli: bool ) -> &mut Self

Override the net.get_fetch_with_cli configuration option

source

pub fn net_offline(&mut self, net_offline: bool) -> &mut Self

Override the net.offline configuration option

source

pub fn add_registry(&mut self, name: String, index: Url) -> &mut Self

Add a new crates.io-style registry to this invocation of cargo

source

pub fn term_verbose(&mut self, term_verbose: bool) -> &mut Self

Sets whether to use verbose stdout in the cargo run

source

pub fn term_color(&mut self, term_color: bool) -> &mut Self

Sets whether to output terminal colors

source

pub fn profile(&mut self, profile: String) -> &mut Self

Override the inherited profile (i.e. --release)

source

pub fn locked(&mut self, locked: bool) -> &mut Self

Override the inherited locked argument (i.e. --locked)

Trait Implementations§

source§

impl Clone for CargoBuilder

source§

fn clone(&self) -> CargoBuilder

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 CargoBuilder

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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, U> Into<U> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.