[][src]Struct escargot::CargoBuild

pub struct CargoBuild { /* fields omitted */ }

The build subcommand.

Example

extern crate escargot;
extern crate assert_fs;

let temp = assert_fs::TempDir::new().unwrap();
escargot::CargoBuild::new()
    .bin("bin")
    .current_release()
    .current_target()
    .manifest_path("tests/fixtures/bin/Cargo.toml")
    .target_dir(temp.path())
    .exec()
    .unwrap();

Methods

impl CargoBuild[src]

pub fn new() -> Self[src]

Shortcut to create a build subcommand.

See also Cargo.

Example

extern crate escargot;
extern crate assert_fs;

let temp = assert_fs::TempDir::new().unwrap();
escargot::CargoBuild::new()
    .bin("bin")
    .manifest_path("tests/fixtures/bin/Cargo.toml")
    .target_dir(temp.path())
    .exec()
    .unwrap();

pub fn package<S: AsRef<OsStr>>(self, name: S) -> Self[src]

Build from name package in workspaces.

Example

extern crate escargot;
extern crate assert_fs;

let temp = assert_fs::TempDir::new().unwrap();
escargot::CargoBuild::new()
    .package("bin")
    .bin("bin")
    .manifest_path("tests/fixtures/bin/Cargo.toml")
    .target_dir(temp.path())
    .exec()
    .unwrap();

pub fn bin<S: AsRef<OsStr>>(self, name: S) -> Self[src]

Build only name binary.

Example

extern crate escargot;
extern crate assert_fs;

let temp = assert_fs::TempDir::new().unwrap();
escargot::CargoBuild::new()
    .bin("bin")
    .manifest_path("tests/fixtures/bin/Cargo.toml")
    .target_dir(temp.path())
    .exec()
    .unwrap();

pub fn example<S: AsRef<OsStr>>(self, name: S) -> Self[src]

Build only name example.

Example

extern crate escargot;
extern crate assert_fs;

let temp = assert_fs::TempDir::new().unwrap();
escargot::CargoBuild::new()
    .example("example_fixture")
    .manifest_path("tests/fixtures/example/Cargo.toml")
    .target_dir(temp.path())
    .exec()
    .unwrap();

pub fn tests(self) -> Self[src]

Build all tests

Example

extern crate escargot;
extern crate assert_fs;

let temp = assert_fs::TempDir::new().unwrap();
escargot::CargoBuild::new()
    .tests()
    .manifest_path("tests/fixtures/test/Cargo.toml")
    .target_dir(temp.path())
    .exec()
    .unwrap();

pub fn test<S: AsRef<OsStr>>(self, name: S) -> Self[src]

Build only name test.

Example

extern crate escargot;
extern crate assert_fs;

let temp = assert_fs::TempDir::new().unwrap();
escargot::CargoBuild::new()
    .test("test")
    .manifest_path("tests/fixtures/test/Cargo.toml")
    .target_dir(temp.path())
    .exec()
    .unwrap();

pub fn manifest_path<S: AsRef<OsStr>>(self, path: S) -> Self[src]

Path to Cargo.toml

pub fn release(self) -> Self[src]

Build artifacts in release mode, with optimizations.

pub fn current_release(self) -> Self[src]

Build artifacts in release mode if the current process has, with optimizations.

pub fn target<S: AsRef<OsStr>>(self, triplet: S) -> Self[src]

Build for the target triplet.

pub fn current_target(self) -> Self[src]

Build for the current process' triplet.

pub fn target_dir<S: AsRef<OsStr>>(self, dir: S) -> Self[src]

Directory for all generated artifacts

pub fn all_features(self) -> Self[src]

Activate all available features

pub fn no_default_features(self) -> Self[src]

Do not activate the default feature

pub fn features<S: AsRef<OsStr>>(self, features: S) -> Self[src]

Space-separated list of features to activate

pub fn arg<S: AsRef<OsStr>>(self, arg: S) -> Self[src]

Manually pass an argument that is unsupported.

Caution: Passing in -- can throw off the API.

pub fn exec(self) -> CargoResult<CommandMessages>[src]

Build the configured target, returning compiler messages.

pub fn run(self) -> CargoResult<CargoRun>[src]

Provide a proxy for running the built target.

Example

extern crate escargot;
extern crate assert_fs;

let temp = assert_fs::TempDir::new().unwrap();
let run = escargot::CargoBuild::new()
    .bin("bin")
    .current_release()
    .current_target()
    .manifest_path("tests/fixtures/bin/Cargo.toml")
    .target_dir(temp.path())
    .run()
    .unwrap();
println!("artifact={}", run.path().display());

pub fn run_tests(
    self
) -> CargoResult<impl Iterator<Item = Result<CargoTest, CargoError>>>
[src]

Provide a proxy for running the built target.

Required feature: test_unstable since the format parsed is unstable.

Example

extern crate escargot;
extern crate assert_fs;

let temp = assert_fs::TempDir::new().unwrap();
let run = escargot::CargoBuild::new()
    .test("test")
    .current_release()
    .current_target()
    .manifest_path("tests/fixtures/test/Cargo.toml")
    .target_dir(temp.path())
    .run_tests().unwrap()
    .next().unwrap().unwrap();
println!("artifact={}", run.path().display());

Trait Implementations

impl Default for CargoBuild[src]

Auto Trait Implementations

impl Send for CargoBuild

impl !Sync for CargoBuild

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

The type returned in the event of a conversion error.

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