[][src]Struct escargot::CargoRun

pub struct CargoRun { /* fields omitted */ }

The run subcommand (emulated).

Created via CargoBuild::run.

Benefits over spawning cargo run:

  • Able to cache binary path, avoiding cargo overhead.
  • Independent of CWD.
  • stdout/stderr are clean of cargo run output.

Relevant features

  • print for logged output to be printed instead, generally for test writing.

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());

Methods

impl CargoRun[src]

pub fn path(&self) -> &Path[src]

Path to the specified binary.

This is to support alternative ways of launching the binary besides Command.

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());

or

extern crate escargot;
extern crate assert_fs;

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

pub fn command(&self) -> Command[src]

Run the build artifact.

Auto Trait Implementations

impl Send for CargoRun

impl Sync for CargoRun

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]